Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>At a relatively <em>higher</em> C/C++ programmer level, how a graph/network is implemented depends quite heavily on what operations are performed on it. Being an OR person myself, I am probably biased in my response/example here. Some of the most efficient algorithms that can be implemented on graphs/networks are polynomial-time algorithms. Most, if not all, polynomial-time algorithms I can think of (Dijkstra's shortest path problem, transportation problem, max-flow problem, etc.) are special cases of the minimum-cost-flow (MCF) problem. Computationally, one of the most efficient ways of solving an MCF problem is via the network-simplex algorithm (which in itself is a specialization of the simplex algorithm to solve a general linear program). </p> <p>In the network-simplex-algorithm, a spanning tree (over the set of nodes) needs to be efficiently represented. To represent a spanning tree in a graph, a variety of data structures can be used. These include the following node-length</p> <pre><code>predecessor[], thread[] and depth[] arrays. </code></pre> <p>In the most efficient implementations of network-simplex-algorithms that I have come across, these are not represented as arrays but some sort of dynamically created block of memory via</p> <pre><code>calloc(number_of_nodes, sizeof(struct vertex)); </code></pre> <p>I am unsure (at a relatively <em>lower</em> level) internal to the compiler what/how this memory allocation is implemented - whether it is a list/set/map.</p> <p>So, in summary, the <em>best</em> way to implement a graph is highly dependent on the operations to be performed on it.</p> <p>Network simplex algorithm and the data structures needed to efficiently implement the same can be found in <a href="http://books.google.com/books?id=2DKKHvV_xVwC" rel="nofollow">this book</a>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload