graph-traversal

How to eliminate all paths that pass through particular document or vertex while during Graph Traversal in ArangoDB

两盒软妹~` 提交于 2019-12-25 01:30:37
问题 I am trying to do a graph traversal here I created two collections in ArangoDB, a document collection "Node" and an edge collection "Path" . All my nodes have a name attribute (labels) and are connected by edges (lines) as shown in above illustration. I tried below query to find paths that end with an end or error node: FOR v, e, p IN 1..10 OUTBOUND 'Node/start_0' Path OPTIONS { bfs: true} FILTER (v.name == "end" OR v.name == "error") RETURN CONCAT_SEPARATOR(' - ', p.vertices[*].name) The

All pairs all paths on a graph

二次信任 提交于 2019-12-23 18:06:41
问题 This is possibly a problem with possibly no optimal solution. Suppose I have a directed graph, have no clue whether it has any cycles or not(cycle detection will be one of the aspects of this problem). Given a set of vertices(possibly millions of vertices) I need to count all the distinct paths(paths with no duplicate vertices) between all the unique pairs of the given graph. How would I go about tackling this situation? Lets look at a brute-force way to do this: Compute all possible pairs

Finding maximum weighted edge in a networkx graph in python

本小妞迷上赌 提交于 2019-12-23 15:26:11
问题 I want to find 'n' maximum weighted edges in a networkx graph. How can it be achieved. I have constructed a graph as follows : g_test = nx.from_pandas_edgelist(new_df, 'number', 'contactNumber', edge_attr='callDuration') Now, I want to find top 'n' edge weights, i.e. top 'n' callDurations. I also want to analyse this graph to find trends from it. Please help me how can this be achieved. 回答1: If your graph is stored as g you can access its edges, including their attributes using: g.edges(data

Neo4J TraversalDescription Definition

瘦欲@ 提交于 2019-12-23 03:51:39
问题 I am trying to create a TraversalDescription that will perform the following search; Return only nodes that have a certain property ("type" == "PERSON") Return a certain fixed number of results (the entire graph is huge, we are only interested in the local graph) Any relationship types can be used I haven't managed to get very far, I can't seem to figure out how to create an Evaluator for node properties; TraversalDescription td = Traversal.description().bredthFirst().evaluator(?...); 回答1: I

Neo4J TraversalDescription Definition

不打扰是莪最后的温柔 提交于 2019-12-23 03:51:27
问题 I am trying to create a TraversalDescription that will perform the following search; Return only nodes that have a certain property ("type" == "PERSON") Return a certain fixed number of results (the entire graph is huge, we are only interested in the local graph) Any relationship types can be used I haven't managed to get very far, I can't seem to figure out how to create an Evaluator for node properties; TraversalDescription td = Traversal.description().bredthFirst().evaluator(?...); 回答1: I

ArangoDB: Get every node, which is in any way related to a selected node

混江龙づ霸主 提交于 2019-12-21 16:54:26
问题 I have a simple node-links graph in ArangoDB. How can I traverse from 1 preselected node and return all nodes which are related to it? For example: A→B, B→C, C→D, C→E, F→B, F→E Selecting any of them should return the same result (all of them). I am very new to ArangoDB. 回答1: What you need is AQL graph traversal, available since ArangoDB 2.8. Older versions provided a set of graph-related functions, but native AQL traversal is faster, more flexible and the graph functions are no longer

Need help parallel traversing a dag in D

落花浮王杯 提交于 2019-12-12 20:20:23
问题 Edit: OK, here's a much much simpler example illustrating my problem. why is only the first task ever put onto the queue? import std.stdio; import std.parallelism; void simpleWorker(uint depth, uint maxDepth, TaskPool pool){ writeln("Depth is: ",depth); if (++depth < maxDepth){ pool.put( task!simpleWorker(depth,maxDepth,pool)); } } void main(){ auto pool = new TaskPool(); pool.put(task!simpleWorker(0,5,pool)); pool.finish(true); writeln("Done"); } Original: I need to traverse this DAG. When I

Prolog: handling cycles in graph traversal

China☆狼群 提交于 2019-12-11 12:14:02
问题 road(london, paris, 135). road(paris, london, 135). road(paris, madrid, 250). road(madrid, paris, 250). road(madrid, barcelona, 70). road(barcelona, madrid, 70). route(X, Y, [X|Y], N) :- road(X, Y, N). route(X, Y, [X|T], N) :- road(X, Z, A), route(Z, Y, [_|T], B), N is A + B. This is a sample code of the problem I am facing. My test input is ?- route(london, barcelona, R, 455). This input will keep re-iterating through london-paris and paris-london, however I have noticed that it will find

Group Parent Vertex and Children through Edges into master/sub json array

对着背影说爱祢 提交于 2019-12-11 09:22:25
问题 First of i am using azure cosmos db. A person works_for multiple Offices. Each Office can be IsMaster or not. If it is a IsMaster it can have master_of edge to another Office. Each works_for edge has AccessLevel property for a person. Logic: Given a Person name, get all Offices that person works_for that are IsMaster = 'true'. Then return all IsMaster with AccessLevel taken from works_for and corresponding SubOffices that each IsMaster has through master_of edge and corresponding AccessLevel

Looking for graph#tree transformer usage examples

你说的曾经没有我的故事 提交于 2019-12-11 07:29:16
问题 I'm writing new transpiler compiler of my programming language Ya. Since the AST Abstract Syntax Tree transformations and output language code generations is a big deal then I'm looking to use existing tree#graph transformers and output generators = pretty printers . Yet up now failed to find the tool since failed to find use examples. The list of promising tools that I've read about: Spoofax + Stratego/XT : have not found source code up now; or maybe found but it's in Java that disallows to