## graph-theory

### Graph searching algorithm

I'm looking for a graph algorithm with some unusual properties. Each edge in the graph is either an "up" edge or a "down" edge. A valid path can go an indefinite number of "up"'s followed by an indefinite number of "down"'s, or vice versa. However it cannot change direction more than once. E.g., a valid path might be A "up" B "up" C "...

### C# graph traversal - tracking path between any two nodes

Looking for a good approach to keep track of a Breadth-First traversal between two nodes, without knowing anything about the graph. Versus Depth-First (where you can throw away the path if it doesn't pan out) you may have quite a few "open" possibilities during the traversal. ...

### Graph Algorithm To Find All Connections Between Two Arbitrary Vertices

I am trying to find out what is the best (time efficient) algorithm to accomplish the task described below. I have a set of records. For this set of records I have connection data which indicates how pairs of records from this set connect to one another (basically a graph, the records being the vertices and the connection data the edges...

### How Does Relational Theory Apply in Ways I can Care About while Learning it?

So I'm taking the Discrete Math course from MIT's OpenCourseWare and I'm wondering... I see the connection between relations and graphs but not enough to "own" it. I've implemented a simple state machine in SQL as well so I grok graphs pretty well, just not the more rigorous study of how relations and sets compeltely apply. Should I just...

### How do you solve the 15-puzzle with A-Star or Dijkstra's Algorithm?

I've read in one of my AI books that popular algorithms (A-Star, Dijkstra) for path-finding in simulation or games is also used to solve the well-known "15-puzzle". Can anyone give me some pointers on how I would reduce the 15-puzzle to a graph of nodes and edges so that I could apply one of these algorithms? If I were to treat each no...

### How to compute the critical path of a directional acyclic graph?

What is the best (regarding performance) way to compute the critical path of a directional acyclic graph when the nodes of the graph have weight? For example, if I have the following structure: Node A (weight 3) / \ Node B (weight 4) Node D (weight 7) / \ Node E (weight...

### Do you know of any .NET components for creating Distance Matrices / Routing graphs ?

Based on geographical data in classic GIS formats. These matrices are a basic input for different vehicle routing problems and such. They can usually be produced an best time or shortest distance basis. ...

### Bron-Kerbosch algorithm for clique finding

Can anyone tell me, where on the web I can find an explanation for Bron-Kerbosch algorithm for clique finding or explain here how it works? I know it was published in "Algorithm 457: finding all cliques of an undirected graph" book, but I can't find free source that will describe the algorithm. I don't need a source code for the algori...

### How to judge the strength of a directed acyclic graph?

Curious what is recognized as a solid algorithm/approach for judging the strength of a directed acyclic graph - particularly the strength of certain nodes. The main question I have about this can be boiled down to the following two graphs: (if graph doesn't show up, click here or visit this link: http://www.flickr.com/photos/[email protected]

### Is there a good graph (not charting) visualization API for .Net?

I've looked at Microsoft GLEE (non-commerical use) and other libraries for drawing graphs, but I need a good commercial use graph API to show complex routes through the Internet. I need to be able to show a large number of nodes and vertexes. Any Ideas? ...

### What is the most efficient way of finding a path through a small world graph?

I have a sea of weighted nodes with edges linking clusters of nodes together. This graph follows the typical small world layout. I wish to find a path finding algorithm, which isn't costly on processor power, to find a path along the best possible path where the nodes are the most favorably weighted, the fastest route is not the most im...

### Find the shortest path in a graph which visits certain nodes.

I have a undirected graph with about 100 nodes and about 200 edges. One node is labelled 'start', one is 'end', and there's about a dozen labelled 'mustpass'. I need to find the shortest path through this graph that starts at 'start', ends at 'end', and passes through all of the 'mustpass' nodes (in any order). ( http://3e.org/local/m...

### What's a good example of a (web) user interface for a graph structure (in the CS sense of graph, nodes, edges)?

Like, let's say I had a tree structure, then I would use, naturally a tree control, since that GUI element maps perfectly to the structure. But what I have is a graph, potentially too wide to fit in one web page. I can't think of examples of GUIs that really match the structure. Some ideas I have that don't quite fit are, the web itse...

### Efficient way to recursively calculate dominator tree?

I'm using the Lengauer and Tarjan algorithm with path compression to calculate the dominator tree for a graph where there are millions of nodes. The algorithm is quite complex and I have to admit I haven't taken the time to fully understand it, I'm just using it. Now I have a need to calculate the dominator trees of the direct children o...

### Best algorithm for detecting cycles in a directed graph

What is the most effiecent alogrithm for detecting all cycles within a directed graph? or I have a directed graph representing a schedule of jobs that need to be exectuted, a job being a node and a dependency being an edge. I need to detect the error case of a cycle within this graph leading to cyclic dependencies. ...

### Secret santa algorithm.

Every Christmas we draw names for gift exchanges in my family. This usually involves mulitple redraws until no one has pulled their spouse. So this year I coded up my own name drawing app that takes in a bunch of names, a bunch of disallowed pairings, and sends off an email to everyone with their chosen giftee. Right now, the algorith...

### finding all vertices in a graph with degree smaller than their neighbors

I'm trying to write an algorithm that will find the set of all vertices in a graph with degree smaller than their neighbors. My initial approach is to find the degree of each vertex, then work through the list, comparing the degree of each vertex with the degree(s) of its neighbors. Unfortunately, this looks like it could be very time co...

### What is a minimal path in a graph?

In graph theory, what is the distinction between minimal distance (which Dijkstra's algorithm finds), and minimal path (which I'm not sure what it is)? ...

### Algorithm to match preferred partners into groups of three

What's a good algorithm to solve this problem? I have three groups of people - group A, group B, and group C. There are the same number of people in each group. They each have a list of people in the other groups that they're willing to work with. I want to group all these people together in groups of 3 (one from A, one from B, and one ...

### Tournament graph question(s)

Is a tournament graph the same thing as a directed complete graph? And, do all vertices in a tournament graph have the same number of edges? ...