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
5
votes
2 answers

Is there a library that provides a (directed) hypergraph implementation in C++?

I'm currently working on a project that enumerates the k-best solutions of a dynamic program using a directed hypergraph framework. My current implementation (in Python) works well, but is fairly slow. The algorithm performs a number of tight…
nomad
  • 1,809
  • 2
  • 18
  • 33
5
votes
2 answers

How to do Topological Sort (Dependency Resolution) with Java

Description The purpose of the question is to implement an interface that will order a list of tasks according to the information about their dependencies. For example, if task A has a dependency on tasks B and C, this means that to start working on…
Dzikoŭski
  • 69
  • 1
  • 7
5
votes
1 answer

Avoid revisiting node in an invariant directed graph

This is perhaps related to functional data structures, but I found no tags about this topic. Say I have a syntax tree type Tree, which is organised as a DAG by simply sharing common sub expressions. For example, data Tree = Val Int | Plus Tree…
Ruifeng Xie
  • 813
  • 4
  • 16
5
votes
1 answer

Build networkx directed graph or flow chart from more than one column of pandas dataframe

I have pandas dataframe which consist of 10 columns. each row consist a step performed by a user to online. there are total of 10 columns so all 10 step process lets say first activity is booking a flight ticket so steps are login website-->give…
Puneet Sinha
  • 1,041
  • 1
  • 10
  • 23
5
votes
1 answer

PHP Library to Generate xdot Files From dot Files

Apologies in advance is I'm misusing terminology, and corrections are appreciated. I'm fascinated by directed graphs, but I never has the math/cs background to know what they're really about, I just like the tech because it makes useful…
Alana Storm
  • 164,128
  • 91
  • 395
  • 599
5
votes
2 answers

How to count all reachable nodes in a directed graph?

There is a directed graph (which might contain cycles), and each node has a value on it, how could we get the sum of reachable value for each node. For example, in the following graph: the reachable sum for node 1 is: 2 + 3 + 4 + 5 + 6 + 7 =…
user8142520
  • 751
  • 1
  • 6
  • 20
5
votes
0 answers

Union-Find/Disjoin-Set data structure for Directed Graph

I'm looking for an efficient Union-Find (aka Disjoint Set) data structure for my directed graph, which has cycles and forests. Given such a graph G , I want to to answer following queries: Can I reach node v from u? From which nodes, u is not…
Shafiul
  • 2,832
  • 9
  • 37
  • 55
5
votes
1 answer

breadth first traversal directed vs undirected graph

how does bfs on directed and undirected graph differ in implementation. i found the following pseudocode on web. i am ok with undirected graph. but can't figure out how to implement it for directed graph. frontier = new Queue() mark root visited…
Yashwanth CB
  • 194
  • 1
  • 14
5
votes
3 answers

Graph incidence list implementation

I'm considering graph data structure implementations and am looking at the "incidence list" representation. There is a brief description of it here: Incidence list So each vertex in the graph stores a list of those edges upon which it is…
Armand A
  • 51
  • 1
  • 1
  • 3
5
votes
2 answers

Most efficient algorithm to generate a random seating chart for benches?

I'm writing an app for a family member who is a teacher. She asked for an app to allow her to enter a bunch of kids, set their handedness, set who they can't sit next to, specify how many seats per bench, and then generate a random layout for the…
5
votes
2 answers

Calculating total number of spanning trees containing a particular set of edges

I have tried the following approach: First I do edge contraction for all the edges in the given set of edges to form a modified graph. Then I calculate the total number of spanning trees, using the matrix tree theorem, from the modified graph. I…
amitkarmakar
  • 1,223
  • 2
  • 13
  • 23
5
votes
3 answers

Data structure and algorithms for a directed cyclic graph (F#)

I'm trying to analyse an application where the assembly references should be a directed-acyclic-graph, but aren't. There is also a related problem of sub-assemblies referencing different versions of one sub-sub-assembly (think Escher...) What I want…
Benjol
  • 63,995
  • 54
  • 186
  • 268
5
votes
1 answer

Finding Shortest path in weighted directional multigraph with extra constraints

Given a weighted directed multigraph, I have to find shortest path between starting vertex u to vertex v. Apart from weight, each edge also has time. The path connecting u and v cannot take more than a given maximum time. The trouble is while using…
Manoj
  • 314
  • 1
  • 2
  • 12
5
votes
0 answers

Drag Node with Dagre-D3

I implemented the functionality, that you can pan and zoom the whole graph but also being able to drag one specific node. My problem at this point is, that I can't find a way how to update the edges while dragging a node. Here you can find a minimal…
Simon S.
  • 563
  • 4
  • 21
5
votes
0 answers

Storing a graph in SQLite - Relational or Flat?

The Problem I need to store a directed graph in an sqlite database and I'm wondering how to solve this. My first solution was to create two tables, one for the nodes and one for the edges, however I'm unsatisfied with the insertion performance…
Simon
  • 428
  • 5
  • 19