graph-theory

Given a Spanning Tree and an Edge Not on the Spanning Tree, How to Form a Cycle Base?

I have a graph with Edge E and Vertex V, I can find the spanning tree using Kruskal algorithm (or any other traverse-backtrack-traverse-again kind of algorithms), now I want to find all the cycle bases that are created by utilitizing that spanning tree and the edges that are not on the tree, any algorithm that allows me to do that, besid...

Why don't the mainstream DBMSs have graph functionality?

Relational databases are frequently used to store graphs in all their many flavors (trees, directed graphs, undirected graphs, ...). Why then do none of the major DBMSs (Microsoft, MySql, Oracle, PostgreSQL, SqlLite, just to name a few in alphabetical order) include library support for treating relations as graphs? Some desirable featu...

How do I partition a bipartite graph by color?

For instance, suppose I have a graph G = (V, E) where V = {A, B, C, D} E = {(A, B), (A,D), (C, D)} This graph is bipartite, and thus can be split into two disjoint sets {A, C} and {B, D}. My first guess is that I can simply walk the graph and assign alternating colors to each vertex. Is this the case, or is it more complicated/simple...

Shortest total path among set of Latitude/Longitudes

I have a set of 52 or so latitude/longitude pairs. I simply need to find the shortest path through all of them; it doesn't matter where staring point or ending point is. I've implemented Dijkstra's algorithm by hand multiple times before and don't really have the time to do it again. I've found a couple things that come close, but most...

What is breadth-first search useful for?

Usually when I've had to walk a graph, I've always used depth-first search because of the lower space complexity. I've honestly never seen a situation that calls for a breadth-first search, although my experience is pretty limited. When does it make sense to use a breadth-first search? UPDATE: I suppose my answer here shows a situati...

Six degrees of Kevin Bacon in Perl

First yes, this is a homework project for my Perl class. I am not looking for the answer (although that would be sweet). As I understand it I need to use a BFS and a regular expression to organize my data for use. I need some direction on this one. How do I use a BFS? Do I use a massive stack and go through each item in the stack? ...

Algorithm for a directed graph problem

Please help me out with an algorithm for the following problem - Given a collection of facts, we would like to get rid of as much redundancy as possible. The facts involved in this problem are members of a transitive relation between uppercase letters. So each fact is a pair of uppercase letters such as AB meaning that A is related to ...

Pac-Man representation with Finite State Automaton

Hi there, Consider a game similar to pac-mac that we want to represent it with an FSA graph. We have a maze (table) and there are berries into it in random positions. The goal is to eat all the berries in the maze. The commands we have to consider for the control are the following: GOAHEAD, LEFT, RIGHT, CHECKBERRY(that checks if there is...

Are there faster algorithms than Dijkstra?

Given a directed, connected graph with only positive edge weights, are there faster algorithms for finding the shortest path between two vertices, than Dijkstra using a fibonacci heap? Wikipedia says, that Dijkstra is in O(|E| + |V| * log(|V|)) (using a fibonacci heap). I'm not looking for optimizations that, for example, half the exec...

Longest circle in graphs

Hi folks, I want to solve the following problem: I have a DAG which contains cities and jobs between them that needs to be done. The jobs are for trucks which can load a definied limit. The more the truck is loaded the better is the tour. Some jobs are for loading something in and some are for loading defined things out. You can always...

Partitioning of a directed graph

I'm trying to partition a network into one or more parts based on a set of critical vertices. I've got code that I believe solves my problem (at least, it has for the cases I'm interested in), but for the sake of ensuring correctness in general, I'm looking for the name of what I'm doing from graph theory, or even a reference on an equiv...

Implementation Detail for Graph Analysis Algorithms

Let's say I have a graph with "heavy" nodes, that is each node is an object that is already carrying a lot of data. I want to do a graph transformation that requires me to calculate a special property for each node. This property only needs to be remembered temporarily to apply the transformation. How can I store this property efficie...

Graph theory question, Java. Which algorithm to achieve the following.

I have a graph, with X nodes and Y edges. Weighted edges. The point is to start at one node, and stop at another. Now here comes the problem; Visualize the problem. The edges are roads, and the edge weights are the max weight limits for vehicles driving on the roads. We would like to drive the biggest truck possible from A to B. So the...

Graph Theory: Find the Jordan center?

I'm trying to find the set of vertices that minimizes their distance to other vertices on a weighted graph. Based on a cursory wikipedia search, I think that this is called the Jordan Center. What are some good algorithms for finding it? Right now, my plan is to get a list of the weight for each branch emanating from a given vertex. The...

Algorithms to eliminate or display outliers in a dataset.

I am trying to visualize a large multi-dimensional dataset. Each dimension has a different range. Values in one column may range between 0-100 while values in another could range from a few hundred thousand to a few hundred million. Therefore it is really hard to show a graph with a reasonable scale. I would like to visualize them using ...

Best way to test for total reachability

I have a set of nodes, each of which is connected to at least one other node. I would like to know if the connections are such that each node is reachable from every other. For example: 1--2 | 3--4 Versus: 1--2 3--4 I am convinced this kind of reachability testing can be projected in terms of an exact cover problem, however I c...

Use Dijkstra's to find a Minimum Spanning Tree?

Dijkstra's is typically used to find the shortest distance between two nodes in a graph. Can it be used to find a minimum spanning tree? If so, how? Edit: This isn't homework, but I am trying to understand a question on an old practice exam. ...

How to compress repeating branches in directed graph?

I work a lot with directed graphs resulting from heap dumps of Java programs. One thing that characterizes them is that they contain lots of repeating patterns. I would like to find a way of compressing such patterns whilst still retaining the essential structure of the graph. For instance consider the following "molecules": | ...

Register allocation and spilling, the easy way?

I'm looking for a way to allocate local variables to registers. I'm aware of a couple of serious methods for doing it (namely, those mentioned on Wikipedia), but I'm stuck on how "spilling" is accomplished. Also, the relevant literature is quite intimidating. I'm hoping there's something simpler that will satisfy my priorities: Corr...

Algorithms question on an n*n matrix of distances

Suppose I have an n*n matrix of distances between n users. I'd like to know what algorithm to use in order to find a route around the group, beginning at user X and returning to user X, with all other nodes visited once but only once, and using the shortest possible distance in each hop. ...