Questions tagged [directed-graph]

A directed graph is a set of objects (called vertices or nodes) that are connected together, where all the edges are directed from one vertex to another. A directed graph is sometimes called a digraph or a directed network.

A directed graph (or digraph) is a , or set of nodes connected by edges, where the edges have a direction associated with them

686 questions
7
votes
1 answer

igraph: positioning labels and removing empty space in grid layout

I want to make a function which plots directed graphs with vertices aligned and adds some text below each vertex, i.e. something like the example plot below. The plotting function should be able to handle pie graphs as vertices, so I have used…
Satu
  • 171
  • 1
  • 8
7
votes
1 answer

State in Erlang Digraphs

The Erlang digraphs module surprised me by mutating state. When dealing with other data structure modules in Erlang, for instance the sets module, the instance of the data structure passed in, is unmodified. The function returns a new, altered…
John Kane
  • 3,601
  • 5
  • 23
  • 18
7
votes
8 answers

Data structure equivalent to map ( in java ) for large datasets

Is there an already implemented data structure that I can use in order to assign to an object (in my case an Edge), an integer? I am reading a graph from a file , 10 mil vertices , 60 mil edges and I assign to each edge , a cost , using a map (…
Radu Stejerean
  • 345
  • 2
  • 13
  • 28
7
votes
6 answers

Can we change Dijkstra's Algorithm to work with negative weights?

The pseudocode as taken from Wikipedia: function Dijkstra(Graph, source): 2 for each vertex v in Graph: // Initializations 3 dist[v] := infinity ; // Unknown distance…
Ori Popowski
  • 10,432
  • 15
  • 57
  • 79
6
votes
7 answers

Finding the path with the maximum minimal weight

I'm trying to work out an algorithm for finding a path across a directed graph. It's not a conventional path and I can't find any references to anything like this being done already. I want to find the path which has the maximum minimum weight. I.e.…
Martin
  • 12,469
  • 13
  • 64
  • 128
6
votes
5 answers

How to do directed graph drawing in PHP?

I'm looking for a way to draw directed graphs in PHP. (as in http://upload.wikimedia.org/wikipedia/commons/0/08/Directed_acyclic_graph.png). I want it to create an image of the graph just like GD can output an image. I've googled a lot on this, but…
openbas2
  • 263
  • 1
  • 7
  • 16
6
votes
3 answers

Find all possible paths from one vertex in a directed cyclic graph in Erlang

I would like to implement a function which finds all possible paths to all possible vertices from a source vertex V in a directed cyclic graph G. The performance doesn't matter now, I just would like to understand the algorithm. I have read the…
skanatek
  • 5,133
  • 3
  • 47
  • 75
6
votes
1 answer

What data structures to use for Dijkstra's algorithm in Erlang?

Disclaimer: The author is a newbie in Erlang. Imagine, we have a graph consisting of 1M nodes, and each node has 0-4 neighbours (the edges are emanating from each node to those neighbours, so the graph is directed and connected). Here is my choice…
skanatek
  • 5,133
  • 3
  • 47
  • 75
6
votes
3 answers

MySQL Store Relationship (Family) Tree

I need to build a family tree in php and MySQL. I'm pretty surprised at the lack of open source customizable html family tree-building software there is out there, but I digress. I have spent a lot of time reading about storing MySQL digraphs and…
Explosion Pills
  • 188,624
  • 52
  • 326
  • 405
6
votes
2 answers

How can I get dot to draw connected subgraphs side by side?

This is what the generated graph looks currently: And here is the code for this: digraph { rankdir=TB; subgraph cluster01 { label="1.fázis" aSTART; node [shape = doublecircle]; a001; node [shape = ellipse]; aSTART -> a0…
Tarnay Kálmán
  • 6,907
  • 5
  • 46
  • 57
6
votes
2 answers

Need help getting to nth level of an adjacency matrix (graph) using a breadth-first search (Java)

public int bfs(int maxDepth){ int src = 2; int dest = 2; int i; int depth = 0; int countPaths = 0; int element; queue.add(src); while(!queue.isEmpty() && depth <= maxDepth) …
6
votes
3 answers

WITH RECURSIVE query to choose the longest paths

I am new to WITH RECURSIVE in PostgreSQL. I have a reasonably standard recursive query that is following an adjacency list. If I have, for example: 1 -> 2 2 -> 3 3 -> 4 3 -> 5 5 -> 6 it produces: 1 1,2 1,2,3 1,2,3,4 1,2,3,5 1,2,3,5,6 What I would…
6
votes
2 answers

Fluent Interface to Build a Directed Cyclic Graph?

I have created a set of classes to represent a directed cyclic graph for representing BPM processes, based on JUNG's DirectedSparseGraph class, which provides only basic graph manipulation methods to add and find vertices and edges. The challenge I…
izilotti
  • 4,757
  • 1
  • 48
  • 55
6
votes
3 answers

A fast way to find connected component in a 1-NN graph?

First of all, I got a N*N distance matrix, for each point, I calculated its nearest neighbor, so we had a N*2 matrix, It seems like this: 0 -> 1 1 -> 2 2 -> 3 3 -> 2 4 -> 2 5 -> 6 6 -> 7 7 -> 6 8 -> 6 9 -> 8 the second column…
blackball
  • 718
  • 1
  • 6
  • 19
6
votes
3 answers

Sparse Multidimensional Array or Matrix Libraries in .NET

I have a need for a sparse matrix in up to 4 dimensions in a .NET application. The size of the matrix (if represented as a .NET Array) would potentially top 400MB. The array is likely to be very sparse, and I need to be able to instantiate and…
Andrew Matthews
  • 3,006
  • 2
  • 29
  • 42