Questions tagged [directed-graph]

A directed graph is a set of objects (called vertices or nodes) that are connected together, where all the edges are directed from one vertex to another. A directed graph is sometimes called a digraph or a directed network.

A directed graph (or digraph) is a , or set of nodes connected by edges, where the edges have a direction associated with them

686 questions
8
votes
4 answers

Merging some sorted lists with unknown order sequence

I've some lists with variable number of elements. Each list is sorted, but the sorting algorithm is not known. I would like to merge the lists into one big list which contains all lists in same order, without duplicates. Example…
Gabriel
  • 127
  • 8
8
votes
3 answers

Count number of cycles in directed graph using DFS

I want to count total number of directed cycles available in a directed graph (Only count is required). You can assume graph is given as adjacency matrix. I know DFS but could not make a working algorithm for this problem. Please provide some…
8
votes
2 answers

GraphSharp .Net Graph Layout Engine

I want to use the apparently fantastic GraphSharp library but the project has NO documentation. Specifically I'm interested in using the layout engine and not interested in the WPF control. I simply want to calculate a layout (positions of the…
Dewiniaeth
  • 1,123
  • 3
  • 18
  • 30
8
votes
1 answer

How To Use Jackson's @JsonIdentityInfo for Deserialization of directed Graphs?

I want to use Jackson 2.3.3 for Deserialization/Serialization of directed graphs. The structure I came up with is roughly the following: public Class Graph { private final Set nodes; public Graph(Set nodes) { ... } public…
MalteJ
  • 111
  • 1
  • 1
  • 7
8
votes
2 answers

Finding all the roots in a directed graph

I need to find an algorithm for finding all the roots in a directed graph, in O(n+m). I have an algorithm for finding a single root: Run DFS(v) on some v in V. If the result is a single spanning tree, then v is a root. Otherwise, the result is a…
amitooshacham
  • 614
  • 1
  • 7
  • 16
8
votes
2 answers

Graphviz Legend/Key with Nodes

I am trying to create a legend/key in Graphviz that contains, not just text, but nodes and edges. While I've read this post, the HTML table does not seem to work with what I am trying to do. Right now, the code I am using is: digraph G…
user2904448
  • 81
  • 1
  • 2
7
votes
1 answer

Is there a formalism for this data structure?

I'm looking for a mathematical formalism for a data structure I'm working with, so that I can track down relevant theorems and algorithms. Suppose you have the following: A directed acyclic graph of topics. At each topic, there are one or more…
7
votes
1 answer

Interactive directed graphs with SVG and Javascript

I have to add some interactive features to SVG directed graphs. So far the graphs I want to show are generated from a dot file and rendered as SVG. I'd like to know if there is some easy way to add interactivity (Maybe with Javascript) to such SVG…
mariosangiorgio
  • 5,520
  • 4
  • 32
  • 46
7
votes
6 answers

Cycle detection in a graph

We are given a graph with the following facts: edge(a,b) edge(a,c) edge(b,a) edge(c,d) edge(d,d) edge(d,e) edge(e,f) edge(f,g) edge(g,e) And we are asked to define a rule, cycle(X), that determines if there is a cycle starting from the node X. I…
Steve
  • 71
  • 1
  • 2
7
votes
3 answers

Plot a directed graph in Python?

I am trying to make a directed graph or Sankey diagram (any would work) for customer state migration. Data looks like below, count means the number of users migrating from the current state to next state. **current_state next_state …
NK09
  • 195
  • 1
  • 12
7
votes
0 answers

Node overlapping edge at directed graph

is it possible that the node does not overlap the edge? I use dagre d3 for the graph. For nodes i use bootstrap. When it is not automatically possible, how can i do it manually? This is an example graph. I need a gerneral solution not specially for…
user7222571
7
votes
1 answer

d3 - "Cannot create property 'vx' on number '65'"

So I'm trying to purpose this great example Force-Directed Graph for some very simple json: https://raw.githubusercontent.com/DealPete/forceDirected/master/countries.json My work is here: codepen I'm getting a never-ending feed of errors from d3…
roberto tomás
  • 4,435
  • 5
  • 42
  • 71
7
votes
1 answer

Generate a directed graph with n cycles

I want to generate a directed graph that contains exactly the specified amount of cycles with their respective length. For example, the graph should contain: 2 cycles of the size 3 1 cycle of the size 5 Does such an algorithm already exist? If…
7
votes
1 answer

Walking a directed graph

I have a directed acyclic graph and an origin vertex v in that graph. How can I visit all the vertices that are reachable from v, in such a way that if I visit v1 I already visited all the vertices that have and edge to…
Daniel
  • 30,896
  • 18
  • 85
  • 139
7
votes
1 answer

Symbol Directed Graph using data from text file

I'm so stuck, I would greatly appreciate some help. I'm currently learning Algorithms, but I have no idea where to start. I was given code recently (We have only really done theory so seeing the code has scared me to my core) And I have been given…
JvK92
  • 135
  • 5