graph-theory

Python :How to generate a power law graph

I have installed networkx and matplotlib packages. How can I generate a power law graph based on degree correlation i.e. graphs with high or low degree of homophily ...

Connected Component Labeling in C++

I need to use the connected component labeling algorithm on an image in a C++ application. I can implement that myself, but I was trying to use Boost's union-find/disjoint sets implementation since it was mentioned in the union-find wiki article. I can't figure out how to create the disjoint_sets object so that it'll work with the image...

need a graph algorithm similar to DFS

Hi, I'm curious if there is a specific graph algorithm that traverses an unweighted acyclic directed graph by choosing a start node and then proceeding via DFS. If a node is encountered that has unsearched predecessors then it should back track the incoming paths until all paths to start have been explored. I found a wikipedia category...

help with terminology of subgraphs

Is there a term to describe a graph who has only one subgraph that is strongly connected? (I'm not even sure I'm using strongly connected correctly here). eg. {AB,BC} has only one subgraph and {AB,BC,DE} has two. Note that I'm not considering that the graph {AB,BC} has three subgraphs: {AB,BC} and {AB} and {BC}. please distinguish be...

Minimal path - all edges at least once

Hello, I have directed graph with lot of cycles, probably strongly connected, and I need to get a minimal cycle from it. I mean I need to get cycle, which is the shortest cycle in graph, and every edge is covered at least once. I have been searching for some algorithm or some theoretical background, but only thing I have found is Chines...

Non-cycle path to all nodes

Is there an algorithm or set of algorithms that would let you find the shortest walking distance from an arbitrary start node so that every node gets visited in a weight, undirected graph? It's not quite Traveling Salesman, because I don't care if a node is visited more than once. (It doesn't even matter if you make it back to the start ...

Easy way to determine whether a given graph is subgraph of some other graph?

Hello, I'm looking for an algorithm to check whether a given graph is subgraph of another given graph. I have few conditions to make this NP complete problem bit more feasible.. The graphs have approx <20 vertices. The graphs are DAG. All vertices are non-uniquely labeled, and the corresponding vertices in the main graph and the subg...

Algorithm to calculate the most energy efficient ad-hoc network

Hi, I have a (theoretical) network with N nodes, each with their own fixed location. Each node sends one message per cycle, which needs to reach the root either directly or via other nodes. The energy cost of sending a message from node A to node B is the distance between them, squared. The challenge is how to link these nodes, in a ...

simple graph theory terminology question

This is a probably a no brainer, and I've been searching but can't seem to find an answer. What is the term (and any alternate terms) for a graph with only two vertices and only one edge between them? This is not a homework question :-) ...

Finding the Reachability Count for all vertices of a DAG

I am trying to find a fast algorithm with modest space requirements to solve the following problem. For each vertex of a DAG find the sum of its in-degree and out-degree in the DAG's transitive closure. Given this DAG: I expect the following result: Vertex # Reacability Count Reachable Vertices in closure 7 5 ...

Finding all shortest paths from every pair of nodes on a graph

I have about 70k nodes, and 250k edges, and the graph isn't necessarily connected. Obviously using an efficient algorithm is crucial. What do you recommend? As a side note, I would appreciate advice on how to divide the task up between several machines--is that even possible with this kind of problem? Thanks ...

graph algorithms on GPU

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 bac...

computing "node closure" of graph with removal

Given a directed graph, the goal is to combine the node with the nodes it is pointing to and come up with minimum number of these [lets give the name] super nodes. The catch is once you combine the nodes you can't use those nodes again. [first node as well as all the combined nodes - that is all the members of one super node] The gr...

Finding contained bordered regions from Excel imports.

I am importing massive amounts of data from Excel that have various table layouts. I have good enough table detection routines and merge cell handling, but I am running into a problem when it comes to dealing with borders. Namely performance. The bordered regions in some of these files have meaning. Data Setup: I am importing directly f...

crossing edges in the travelling salesman problem

Does there exist a travelling salesman problem where the optimal solution has edges that cross? The nodes are in an x-y plane, so crossing in this case means if you were to draw the graph, two line segments connecting four separate nodes would intersect. ...

Provable planarity of flowcharts

I have a question: is there any reference (e.g. paper) with a proof of the planarity of flowchart layouts? Can anyone suggest an algorithm for generating flowchart (planar) layouts? I know that there are some code-to-flowchart tools out there, but i'm unaware of their internals. ...

How to find whole graph coverage path in dynamic state-flow diagram?

Hello, As I've been researching algorithms for path finding in graph, I found interesting problem. Definition of situation: 1)State diagram can have p states, and s Boolean Fields, and z Int Fields 2)Every state can have q ingoing and r outgoing transitions, and h Int fields (h belongs to z - see above) 3)Every transition can have on...

How to spread changes in oriented graph?

Hello, I have oriented graph. Graph can be strongly connected. Every vertex can have a set of anything, for example letters. The set is user editable. Every vertex makes intersection of sets in previous vertices (only one step back). But now, there is problem: When I update set of one vertex, the change should expand to all vertices an...

count of distinct acyclic paths from A[a,b] to A[c,d]?

I'm writing a sokoban solver for fun and practice, it uses a simple algorithm (something like BFS with a bit of difference). now i want to estimate its running time ( O and omega). but need to know how to calculate count of acyclic paths from a vertex to another in a network. actually I want an expression that calculates count of valid ...

Graph theory in python

I was wondering how people deal with graph theory in python? How is a graph stored? Are there libraries for this? For example how would I input a graph and then find its Chromatic polynomial? Or its girth? Or the number of unique spanning trees? How about problems that involve edge weight like salesman problems? I don't need all of the...