directed-graph

Does the dot Directed Graph allow for subgraphs with a different rankdir?

◇◆丶佛笑我妖孽 提交于 2019-12-10 02:51:58
问题 Using the dot directed graph language, is it possible to create subgraphs with a different rankdir? I tried the following, which didn't work. Both graphs were left to right, despite the presence of rankdir="TB" in the subgraph. digraph g { rankdir="LR"; LEFT->RIGHT; clusterrank="local"; subgraph cluster1 { rankdir="TB"; node[style=filled]; color=black; TOP->BOTTOM; } } Is there some other syntax to get a Top/Bottom and Left/Right graph in the same diagram, or is this not possible? 回答1: Seems

How do I find all paths through a set of given nodes in a DAG?

青春壹個敷衍的年華 提交于 2019-12-09 09:30:31
问题 I have a list of items (blue nodes below) which are categorized by the users of my application. The categories themselves can be grouped and categorized themselves. The resulting structure can be represented as a Directed Acyclic Graph (DAG) where the items are sinks at the bottom of the graph's topology and the top categories are sources. Note that while some of the categories might be well defined, a lot is going to be user defined and might be very messy. Example: (source: theuprightape

What is the most efficient way to determine if a directed graph is singly connected?

a 夏天 提交于 2019-12-09 05:23:12
问题 I am working on an assignment where one of the problems asks to derive an algorithm to check if a directed graph G=(V,E) is singly connected (there is at most one simple path from u to v for all distinct vertices u,v of V. Of course you can brute force check it, which is what I'm doing right now, but I want to know if there's a more efficient way. Could anyone point me in the right direction? 回答1: Have you tried DFS. Run DFS for every vertex in the graph as source If a visited vertex is

What options are available for the layout of directed or undirected graphs in .NET?

只愿长相守 提交于 2019-12-09 04:15:25
问题 By graph here I mean something resembling these images: The ideal solution would: use only managed code allow output to a bitmap image allow output to WPF elements include some kind of interactive surface for displaying the graph that supports zooming, panning and reorganisation of nodes I'm also interested in hearing about projects that could potentially be used as the starting point for this kind of work. If it requires some development to achieve what I want, then I'm prepared to tackle it

how to highlight(change color) of all connected(neighbours) nodes and links in a d3 force directed graph

十年热恋 提交于 2019-12-07 23:48:33
问题 I saw this example here http://www.d3noob.org/2013/03/d3js-force-directed-graph-example-basic.html I can understand it to an extent where I can make basic changes, but have not been able to do one thing specifically which is to highlight (change color) of all connected nodes. e.g If I mouse over node 1 or click on node 1,it should find all neighboring nodes and highlight the link paths by changing color. I looked at clicking a node in d3 from a button outside the svg already answered but I

What if I do not use G transpose in calculating Strongly Connected Components?

不打扰是莪最后的温柔 提交于 2019-12-07 19:35:53
问题 I am reading Introduction to Algorithms. In 22.5 Strongly Connected Component, the algorithm STRONGLY-CONNECTED-COMPONENT(G) is defined as: Call DFS(G) to compute finishing times u.f for each vertex u Compute G transpose Call DFS(G transpose), but in the main loop of DFS, consider the vertices in order of decreasing u.f(as computed in line 1) Output the vertices of each tree in the depth-first forest formed in line 3 as a separate strongly connected component If I change the alogrithm to just

Graph incidence list implementation

故事扮演 提交于 2019-12-07 13:42:11
问题 I'm considering graph data structure implementations and am looking at the "incidence list" representation. There is a brief description of it here: Incidence list So each vertex in the graph stores a list of those edges upon which it is incident. Given that my graph is a directed graph, I'm not very clear from this description on a couple of points: Does the graph itself also store a list of all edges? Do vertices only store outgoing edges, or incoming and outgoing? If both, are they in

How to do directed graph drawing in PHP?

只愿长相守 提交于 2019-12-07 02:23:56
问题 I'm looking for a way to draw directed graphs in PHP. (as in http://upload.wikimedia.org/wikipedia/commons/0/08/Directed_acyclic_graph.png). I want it to create an image of the graph just like GD can output an image. I've googled a lot on this, but I only can find a lot of libraries for drawing graphs in general (with bars etc), not directed graphs. P.S. I've tried using dot (the linux program) via system(), but unfortunately I have no permission to do that on the server. Also, I have no

Is backtracking absolutely necessary for cycle detection using DFS in directed graph?

[亡魂溺海] 提交于 2019-12-06 11:26:22
I came across this SO post where it is suggested that cycle detection using DFS in a directed graph is faster because of backtracking. Here I quote from that link: Depth first search is more memory efficient than breadth first search as you can backtrack sooner. It is also easier to implement if you use the call stack but this relies on the longest path not overflowing the stack. Also if your graph is directed then you have to not just remember if you have visited a node or not, but also how you got there. Otherwise you might think you have found a cycle but in reality all you have is two

Python NetworkX find a subgraph in a Directed Graph from a node as root

[亡魂溺海] 提交于 2019-12-06 10:51:32
I am writing a code to extract information from a directed graph. This graph has cycles as well. For example, A->B->C->D A->E->F->A B->F->G From this graph, I want to create a sub graph or the list of the nodes, where the input would be any node, and output would be the graph where the input node is the root, or the list of the nodes that has all the child nodes ( till the end of the graph ) from the input nodes For example, in the above example, 1. If the input node is C, the output would be D 2. If the input node is B, the output node would be C,D,F,G,A ( Since there is a cycle, which makes