graph-theory

Calculate shortest path through a grocery store

Hi, I'm trying to find a way to find the shortest path through a grocery store, visiting a list of locations (shopping list). The path should start at a specified startposition and can end at multiple endpositions (there are multiple checkout counters). Also, I have some predefined constraints on the path, such as "item x on the shoppin...

Which algorithm to find the nearest node reachable from the other one by all the outoging paths.

Hello, Which algorithm do you recommend to find out the nearest node which can be reached from the specific one by all the paths coming out the node. The graph is directed unweight. I'm trying to analyze control flow diagram and when there is a 'IF' block I want to find the block which "closes" the 'IF'. ...

Will a source-removal sort always return a maximal cycle?

I wrote a source-removal algorithm to sort some dependencies between tables in our database, and it turns out we have a cycle. For simplicity, let's say we have tables A, B, C, and D. The edges are like this: (A, B) (B, A) (B, C) (C, D) (D, A) As you can see, there are two cycles here. One is between A and B and another is between ...

What is the relaxation condition in graph theory

Hi, I'm trying to understand the main concepts of graph theory and the algorithms within it. Most algorithms seem to contain a "Relaxation Condition" I'm unsure about what this is. Could some one explain it to me please. An example of this is dijkstras algorithm, here is the pseudo-code. 1 function Dijkstra(Graph, source): 2 ...

Graph Theory: How to compute closeness centrality for each node in a set of data?

I'd like to learn how to apply network theory to my own cache of relational data. I'm trying to build a demo of a new way of browsing a music library, using network theory, that I think would make for a very intuitive and useful way of finding the right song at any given time. I have all the data (artists as nodes, similarity from 0 to...

Graphs data structure: DFS vs BFS?

if given a graph problem how do we know whether we need to use bfs or dfs algorithm??? or when do we use dfs algorithm or bfs algorithm. What are the differences and advantages of one over other? ...

efficacy of register allocation algorithms!

i'm trying to do a research/project on register allocation using graph coloring where i am to test the efficiency of different optimizing register allocation algorithms in different scenarios. how do i start? what are the prerequisites and the grounds with which i can test them. what all algos can i use? -------------addition----------...

An approximate algorithm for finding Steiner Forest.

Hello. Consider a weighted graph G=(V,E,w). We are given a family of subsets of vertices V_i. A Steiner Forest is a forest that for each subset of vertices V_i connects all of the vertices in this subset with a tree. Example: only one subset V_1 = V. In this case a Steiner forest is a spanning tree of the whole graph. Example: a grap...

Amazing families of algorithms over implicit graphs

Dynamic programming is, almost by definition, to find a shortest/longest path on an implicit dag. Every DP algorithm just does this. An Holographic algorithm can be loosely described as something that counts perfect matchings in implicit planar graphs. So, my question is: are there any other families of algorithms that use well-known a...

Graph Algorithm To Find All Paths Between N Arbitrary Vertices

I have an graph with the following attributes: Undirected Not weighted Each vertex has a minimum of 2 and maximum of 6 edges connected to it. Vertex count will be < 100 Graph is static and no vertices/edges can be added/removed or edited. I'm looking for paths between a random subset of the vertices (at least 2). The paths should s...

Search a DAG with boolean constraints on reachability

The queries are something like Return all vertices such that (reachable from (A and (B or C))) and (not reachable from (D and E)). The query can be formed with any kind of boolean constraints on reachability. Are there efficient methods to do this query fast? Other than actually find the set of all item reachable vertex of concern, t...

Measuring how "heavily linked" a node is in a graph

I have posted this question at MathOverflow.com as well. I am no mathematician and English is not my first language, so please excuse me if my question is too stupid, it is poorly phrased, or both. I am developing a program that creates timetables. My timetable-creating algorithm, besides creating the timetable, also creates a graph who...

How to minimize total cost of shortest path tree

I have a directed acyclic graph with positive edge-weights. It has a single source and a set of targets (vertices furthest from the source). I find the shortest paths from the source to each target. Some of these paths overlap. What I want is a shortest path tree which minimizes the total sum of weights over all edges. For example, con...

A two way minimum spanning tree of a directed graph

Given a directed graph with weighted edges, what algorithm can be used to give a sub-graph that has minimum weight, but allows movement from any vertex to any other vertex in the graph (under the assumption that paths between any two vertices always exist). Does such an algorithm exist? ...

Find all complete sub-graphs within a graph

Is there a known algorithm or method to find all complete sub-graphs within a graph? I have an undirected, unweighted graph and I need to find all subgraphs within it where each node in the subgraph is connected to each other node in the subgraph. Is there an existing algorithm for this? ...

Calculating Divergent Paths on Subtending Rings

I need to calculate two paths from A to B in the following graph, with the constraint that the paths can't share any edges: hmm, okay, can't post images, here's a link. All edges have positive weights; for this example I think we can assume that they're equal. My naive approach is to use Djikstra's algorithm to calculate the first pat...

Can Goldberg algorithm in ocamlgraph be used to find Minimum Cost Flow graph?

I'm looking for an implementation to the Minimum Cost Flow graph problem in OCaml. OCaml library ocamlgraph has Goldberg algorithm implementation. The paper called Efficient implementation of the Goldberg-Tarjan minimum-cost flow algorithm is noting that Goldberg-Tarjan algorithm can find minimum cost graph. Question is, does ocamlgrap...

Find all cycles in graph, redux

Hi, I know there are a quite some answers existing on this question. However, I found none of them really bringing it to the point. Some argue that a cycle is (almost) the same as a strongly connected components (s. http://stackoverflow.com/questions/546655/finding-all-cycles-in-graph/549402#549402) , so one could use algorithms designe...

How would you solve this graph theory handshake problem in python?

I graduated college last year with a degree in Psychology, but I also took a lot of math for fun. I recently got the book "Introductory Graph Theory" by Gary Chartrand to brush up on my math and have some fun. Here is an exercise from the book that I'm finding particularly befuddling: Suppose you and your husband attended a party w...

Create a "pairing" from a graph?

This problem smells like there should be an answer in graph theory, but it doesn't exactly match any of the graph theory problems I know. (Note: this is actually a real-world problem, fictionalized for easier reading) Imagine that I have a even-numbered group of Chess players at my house. I have plenty of tables and chess sets for every...