graph-theory

graph algorithms on GPU

人走茶凉 提交于 2019-12-03 18:20:33
问题 the current GPU threads are somehow limited (memory limit, limit of data structures, no recursion...). do you think it would be feasible to implement a graph theory problem on GPU. for example vertex cover? dominating set? independent set? max clique?.... is it also feasible to have branch-and-bound algorithms on GPUs? Recursive backtracking? 回答1: You will be interested in Exploring the Limits of GPUs With Parallel Graph Algorithms Accelerating large graph algorithms on the GPU using CUDA.

Enumerating cycles in a graph using Tarjan's algorithm

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 16:57:59
I'm trying to determine the cycles in a directed graph using Tarjan's algorithm, presented in his research paper "Enumeration of the elementary circuits of a directed graph" from Septermber 1972. I'm using Python to code the algorithm, and an adjacency list to keep track of the relationships between nodes. So in "G" below, node 0 points to node 1, node 1 points to nodes 4,6,7... etc. G = [[1], [4, 6, 7], [4, 6, 7], [4, 6, 7], [2, 3], [2, 3], [5, 8], [5, 8], [], []] N = len(G) points = [] marked_stack = [] marked = [False for x in xrange(0,N)] g = None def tarjan(s, v, f): global g points

Add a edge to direct acyclic graph with other restrictions

為{幸葍}努か 提交于 2019-12-03 16:36:48
I have a DAG. I have this operation to add a edge between two nodes. If A is reachable from B, then B is A's parent. If A is reachable from B without going though another node, then B is A's direct parent. Requirements for this graph are: No cycles. For any node, there is a list of direct parents P[1],P[2],P[3]... P[i] is not a parent of P[j] for any i and j. If adding a edge, requirement 1 is not met, the edge is not constructed. If adding a edge, requirement 2 is not met, the edge is constructed, but the direct parents will be modified in a way such that requirement 2 is met. For example,

Elegant examples of xslt?

一个人想着一个人 提交于 2019-12-03 16:16:27
After a long learning loop via XAML, I've returned to HTML and javascript, and realised that the concept of declarative code - in terms of rules for transformation - is an incredibly powerful concept. Despite its surfeit of syntax, XSLT processing of XML is the keystone of declarative transformation programming. I have, however, always found it hard to understand how XSLT would be used for everyday tasks (with XML). What are some good examples of XSLT elegantly solving a programming problem, outside of generating HTML? I'm guessing it's good at graph transformation and data reprocessing...

How to draw parallel edges in Networkx / Graphviz

社会主义新天地 提交于 2019-12-03 15:47:44
I am trying to add parallel edges between two nodes using NetworkX but it fails with the below error. What am I doing wrong? import networkx as nx import graphviz g1 = nx.MultiGraph() node1 = 'a' node2 = 'b' g1.add_edge(node1,node2,key='one') g1.add_edge(node1,node2,key='two') A = nx.to_agraph(g1) A.add_subgraph() A.draw('test2.png', prog='dot') Error: Traceback (most recent call last): File "test2.py", line 12, in <module> A = nx.to_agraph(g1) File "C:\python27\lib\site-packages\networkx-1.11rc1-py2.7.egg\networkx\drawing\nx_agraph.py", line 152, in to_agraph A.add_edge(u,v,key=str(key),**str

Is it possible to store graphs hbase? if so how do you model the database to support a graph structure?

痞子三分冷 提交于 2019-12-03 15:40:21
I have been playing around with using graphs to analyze big data. Its been working great and really fun but I'm wondering what to do as the data gets bigger and bigger? Let me know if there's any other solution but I thought of trying Hbase because it scales horizontally and I can get hadoop to run analytics on the graph(most of my code is already written in java), but I'm unsure how to structure a graph on a nosql database? I know each node can be an entry in the database but I'm not sure how to model edges and add properties to them(like name of nodes, attributes, pagerank, weights on edges

How to find mother vertex in a directed graph in O(n+m)? [closed]

心不动则不痛 提交于 2019-12-03 15:26:07
Closed . This question needs to be more focused. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it focuses on one problem only by editing this post . Closed 16 days ago . A mother vertex in a directed graph G = (V,E) is a vertex v such that all other vertices G can be reached by a directed path from v Give an O(n+m) algorithm to test whether graph G contains a mother vertex. (c) from Skiena manual Found only O(n(n+m)) way Algorithm:: a) Do DFS/BFS of the graph and keep track of the last finished vertex 'x' . b) If there exist any

Basic questions about nested blockmodel in graph-tool

感情迁移 提交于 2019-12-03 15:08:37
Very briefly, two-three basic questions about the minimize_nested_blockmodel_dl function in graph-tool library . Is there a way to figure out which vertex falls onto which block? In other words, to extract a list from each block, containing the labels of its vertices. The hierarchical visualization is rather difficult to understand for amateurs in network theory, e.g. are the squares with directed edges that are drawn meant to implicate the main direction of the underlying edges between two blocks under consideration? The blocks are nicely shown using different colors, but on a very conceptual

Does it Make Sense to Map a Graph Data-structure into a Relational Database?

六月ゝ 毕业季﹏ 提交于 2019-12-03 15:05:21
Specifically a Multigraph . Some colleague suggested this and I'm completely baffled. Any insights on this? It's pretty straightforward to store a graph in a database: you have a table for nodes, and a table for edges, which acts as a many-to-many relationship table between the nodes table and itself. Like this: create table node ( id integer primary key ); create table edge ( start_id integer references node, end_id integer references node, primary key (start_id, end_id) ); However, there are a couple of sticky points about storing a graph this way. Firstly, the edges in this scheme are

How to find all vertex-disjoint paths in a graph?

只愿长相守 提交于 2019-12-03 14:34:02
Suppose there are 3 target nodes in a graph. A vertex-disjoint path means there is not any same node except the end nodes during the path. For any one single node, say node i, how to find all vertex-disjoint paths from node i to the three target nodes? You can solve this problem by reducing it to a max-flow problem in an appropriately-constructed graph. The idea is as follows: Split each node v in the graph into to nodes: v in and v out . For each node v, add an edge of capacity one from v in to v out . Replace each other edge (u, v) in the graph with an edge from u out to v in of capacity 1.