README 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. GRAPH.TXT : text description of a graph
  2. $ cr_from_a --file=GRAPH.TXT --graph=graph.dgl
  3. read GRAPH.TXT and create graph.dgl
  4. $ view --graph=graph.dgl
  5. View the graph.dgl content (node attributes are not printed)
  6. $ shortest_path --graph=graph.dgl --from=1 --to=80
  7. Figure out shortest path from node 1 to node 5
  8. How to store X/Y/Z node coordinates:
  9. Node coordinates can be assigned as node attributes. In the GRAPH.TXT file
  10. lines beginning with 'A' are arcs, lines beginning with 'N' are node attributes.
  11. Each coordinate is stored as 32 bit integer. Thus when creating the graph
  12. (cr_from_a.c) I reserved 12 bytes for xyz values.
  13. See the GngSetNodeAttr() usage in cr_from_a.c
  14. The node attributes are passed back to the clip_node() callback during Dijkstra
  15. so that the user can check if the node is still into an arbitrary bounding box
  16. (see shortest_path.c).
  17. Clipping demo:
  18. Try to go from node 1 to node 80:
  19. $ ./shortest_path --graph=graph.dgl --from=1 --to=80
  20. See the result and then try to clip out node 3:
  21. $ ./shortest_path --graph=graph.dgl --from=1 --to=80 --discard=3
  22. The path will now use intermediate 2 instead of 3, resulting in a
  23. longer path.
  24. The test program cr_large_graph aims at figuring out performances, creating a graph of
  25. 357202/60000 arc/node.
  26. Given that lot of insertion slowness depends on the node ids sorting, cr_large_graph can
  27. run in two ways: sorted ot interlaced.
  28. These are my time results (700Mhz intel):
  29. time ./cr_large_graph --graph=graphfile
  30. real 0m42.537s
  31. user 0m40.250s
  32. sys 0m1.060s
  33. time ./cr_large_graph --graph=graphfile --interlaced
  34. real 0m11.012s
  35. user 0m9.200s
  36. sys 0m1.020s
  37. When compiled with the -DGNGRP_STATS, cr_large_graph prints a line like this at (almost)
  38. each arc insertion:
  39. add arc 0238592 - from 0000203 - to 0000103 - cost 0010000 . Clock: tot 000000029 nt 000000015 nh 000000000 o 000000003
  40. The meaning of clocks are:
  41. tot = average number of clocks consumed by calls to gnGrpAddLink()
  42. nt = component of 'tot' spent in the node binary tree
  43. nh = component of 'tot' spent in the node heap
  44. o = component of 'tot' spent for all other operations
  45. Warn: the libdgl must also have been compiled with -DGNGRP_STATS.
  46. The next is the time spent to load 'graphfile' into memory and performing
  47. a shortest-path search from the node 0 to 59999 (that is from
  48. the upper-left to the lower-right of the network):
  49. time ./shortest_path --graph=graphfile --from=0 --to=59999
  50. real 0m4.579s
  51. user 0m3.940s
  52. sys 0m0.130s