From 3192e2fa8640ecdafcb93cdf904f06f7d17dd23f Mon Sep 17 00:00:00 2001 From: ZigRazor Date: Thu, 9 Sep 2021 11:37:32 +0200 Subject: [PATCH 1/2] Documentation Update (#52) * Updated Doxygen Documentation * [CodeFactor] Apply fixes to commit 0527010 Co-authored-by: codefactor-io --- docs/html/annotated.html | 45 +- docs/html/classes.html | 18 +- ...rdinatedPartitionState__inherit__graph.map | 4 + ...rdinatedPartitionState__inherit__graph.md5 | 1 + ...rdinatedPartitionState__inherit__graph.png | Bin 0 -> 7372 bytes ...ITIONING_1_1CoordinatedPartitionState.html | 149 + docs/html/d0/df2/classCXXGRAPH_1_1Graph.html | 106 +- ...PH_1_1PARTITIONING_1_1Globals-members.html | 93 + ...classCXXGRAPH_1_1PARTITIONING_1_1HDRF.html | 115 + .../UndirectedWeightedEdge_8hpp_source.html | 197 + docs/html/d2/d3f/classCXXGRAPH_1_1Reader.html | 4 +- .../d2/d40/PartitioningStats_8hpp_source.html | 151 + .../classCXXGRAPH_1_1Graph__TS-members.html | 26 +- docs/html/d2/de9/ThreadSafe_8hpp_source.html | 132 + docs/html/d2/df2/HDRF_8hpp_source.html | 291 ++ docs/html/d3/d4d/Typedef_8hpp_source.html | 170 + docs/html/d3/d6b/Record_8hpp_source.html | 125 + docs/html/d3/d91/Graph__TS_8hpp_source.html | 340 ++ docs/html/d3/dd2/classCXXGRAPH_1_1Node.html | 2 +- ...assCXXGRAPH_1_1PARTITIONING_1_1Record.html | 124 + docs/html/d4/d1e/ConstValue_8hpp_source.html | 113 + .../d5/d2e/classCXXGRAPH_1_1Runnable.html | 94 + .../d36/PartitionAlgorithm_8hpp_source.html | 120 + docs/html/d5/d64/Globals_8hpp_source.html | 147 + docs/html/d5/d80/CXXGraph_8hpp_source.html | 107 + .../structCXXGRAPH_1_1DialResult__struct.html | 4 +- .../d5/db2/UndirectedEdge_8hpp_source.html | 188 + ...PARTITIONING_1_1Partition__coll__graph.map | 4 + ...PARTITIONING_1_1Partition__coll__graph.md5 | 1 + ...PARTITIONING_1_1Partition__coll__graph.png | Bin 0 -> 6031 bytes .../html/d6/d85/DirectedEdge_8hpp_source.html | 189 + .../d6/d85/PartitionStrategy_8hpp_source.html | 125 + ..._1_1PARTITIONING_1_1PartitionerThread.html | 104 + ...assCXXGRAPH_1_1UndirectedWeightedEdge.html | 5 +- docs/html/d7/d2a/classCXXGRAPH_1_1Edge.html | 2 +- ..._1_1PARTITIONING_1_1Partition-members.html | 111 + .../d7/d59/CoordinatedRecord_8hpp_source.html | 210 + ...ITIONING_1_1PartitioningStats-members.html | 98 + docs/html/d7/dc6/Node_8hpp_source.html | 175 + docs/html/d7/dde/classCXXGRAPH_1_1Writer.html | 4 +- docs/html/d7/de1/ConstString_8hpp_source.html | 115 + docs/html/d8/d2b/Runnable_8hpp_source.html | 116 + ..._1PARTITIONING_1_1Partitioner-members.html | 87 + ...TITIONING_1_1Partition__inherit__graph.map | 4 + ...TITIONING_1_1Partition__inherit__graph.md5 | 1 + ...TITIONING_1_1Partition__inherit__graph.png | Bin 0 -> 6031 bytes ...XGRAPH_1_1PARTITIONING_1_1Partitioner.html | 97 + docs/html/d8/d91/Partitioner_8hpp_source.html | 190 + ...NING_1_1CoordinatedRecord__coll__graph.map | 4 + ...NING_1_1CoordinatedRecord__coll__graph.md5 | 1 + ...NING_1_1CoordinatedRecord__coll__graph.png | Bin 0 -> 6846 bytes ...H_1_1PARTITIONING_1_1HDRF__coll__graph.map | 4 + ...H_1_1PARTITIONING_1_1HDRF__coll__graph.md5 | 1 + ...H_1_1PARTITIONING_1_1HDRF__coll__graph.png | Bin 0 -> 6630 bytes .../d9/d2f/classCXXGRAPH_1_1ThreadSafe.html | 2 +- docs/html/d9/d69/Graph_8hpp_source.html | 3733 ++++++----------- ...ITIONING_1_1PartitionerThread-members.html | 88 + .../da/d0e/PartitionerThread_8hpp_source.html | 160 + ...NING_1_1PartitionState__inherit__graph.map | 4 + ...NING_1_1PartitionState__inherit__graph.md5 | 1 + ...NING_1_1PartitionState__inherit__graph.png | Bin 0 -> 7351 bytes ...classCXXGRAPH_1_1DirectedWeightedEdge.html | 2 +- ...ITIONING_1_1CoordinatedRecord-members.html | 96 + ..._1_1PARTITIONING_1_1PartitioningStats.html | 137 + .../da/da5/classCXXGRAPH_1_1Graph__TS.html | 85 +- ...CoordinatedPartitionState__coll__graph.map | 4 + ...CoordinatedPartitionState__coll__graph.md5 | 1 + ...CoordinatedPartitionState__coll__graph.png | Bin 0 -> 7372 bytes .../dea/DirectedWeightedEdge_8hpp_source.html | 196 + ...ITIONING_1_1PartitionStrategy-members.html | 85 + ...PARTITIONING_1_1Record__inherit__graph.map | 4 + ...PARTITIONING_1_1Record__inherit__graph.md5 | 1 + ...PARTITIONING_1_1Record__inherit__graph.png | Bin 0 -> 6808 bytes .../db/d54/classCXXGRAPH_1_1Weighted.html | 2 +- ...ssCXXGRAPH_1_1PARTITIONING_1_1Globals.html | 119 + docs/html/dc/d4d/Partition_8hpp_source.html | 348 ++ .../dc/d50/PartitionState_8hpp_source.html | 130 + ...classCXXGRAPH_1_1Graph__inherit__graph.map | 6 +- ...classCXXGRAPH_1_1Graph__inherit__graph.md5 | 2 +- ...classCXXGRAPH_1_1Graph__inherit__graph.png | Bin 7217 -> 9738 bytes docs/html/dc/d91/Edge_8hpp_source.html | 201 + ...GRAPH_1_1PARTITIONING_1_1HDRF-members.html | 87 + ...uctCXXGRAPH_1_1DijkstraResult__struct.html | 4 +- ..._1_1PARTITIONING_1_1CoordinatedRecord.html | 143 + ...ARTITIONING_1_1PartitionState-members.html | 93 + ...CXXGRAPH_1_1PARTITIONING_1_1Partition.html | 229 + ..._1_1CoordinatedPartitionState-members.html | 98 + .../d77/classCXXGRAPH_1_1Graph-members.html | 23 +- ...G_1_1PartitionStrategy__inherit__graph.map | 4 + ...G_1_1PartitionStrategy__inherit__graph.md5 | 1 + ...G_1_1PartitionStrategy__inherit__graph.png | Bin 0 -> 6592 bytes .../classCXXGRAPH_1_1Runnable-members.html | 85 + ...G_1_1CoordinatedRecord__inherit__graph.map | 4 + ...G_1_1CoordinatedRecord__inherit__graph.md5 | 1 + ...G_1_1CoordinatedRecord__inherit__graph.png | Bin 0 -> 6846 bytes docs/html/de/dac/Writer_8hpp_source.html | 123 + ...APH_1_1PARTITIONING_1_1Record-members.html | 92 + ...CoordinatedPartitionState_8hpp_source.html | 274 ++ ..._1_1PARTITIONING_1_1PartitionStrategy.html | 103 + .../de/df5/classCXXGRAPH_1_1DirectedEdge.html | 2 +- docs/html/df/d03/Reader_8hpp_source.html | 117 + ..._1PARTITIONING_1_1HDRF__inherit__graph.map | 4 + ..._1PARTITIONING_1_1HDRF__inherit__graph.md5 | 1 + ..._1PARTITIONING_1_1HDRF__inherit__graph.png | Bin 0 -> 6630 bytes ...APH_1_1PARTITIONING_1_1PartitionState.html | 127 + .../d71/classCXXGRAPH_1_1UndirectedEdge.html | 5 +- docs/html/df/dd3/Weighted_8hpp_source.html | 149 + .../dir_5a1c299fe071d2684abbfdc4f5a71058.html | 81 + .../dir_664b94fe24dd8b5b31bd73b721ea4656.html | 81 + .../dir_701c8f06b1c05dfef7c59ec059aa05bd.html | 81 + .../dir_b647303d7dac632cf2e2685370b563a8.html | 81 + .../dir_c632fc99025ef8bfa3e097f773c00de6.html | 85 + .../dir_d192150ed164ec0bf3db1023d7b06f0a.html | 81 + .../dir_d44c64559bbebec7f509842c48db8b23.html | 4 + docs/html/files.html | 38 +- docs/html/functions.html | 31 +- docs/html/functions_func.html | 12 +- docs/html/hierarchy.html | 34 +- docs/html/inherit_graph_10.map | 4 + docs/html/inherit_graph_10.md5 | 1 + docs/html/inherit_graph_10.png | Bin 0 -> 4536 bytes docs/html/inherit_graph_11.map | 4 + docs/html/inherit_graph_11.md5 | 1 + docs/html/inherit_graph_11.png | Bin 0 -> 4126 bytes docs/html/inherit_graph_12.map | 3 + docs/html/inherit_graph_12.md5 | 1 + docs/html/inherit_graph_12.png | Bin 0 -> 2151 bytes docs/html/inherit_graph_13.map | 3 + docs/html/inherit_graph_13.md5 | 1 + docs/html/inherit_graph_13.png | Bin 0 -> 2200 bytes docs/html/inherit_graph_14.map | 3 + docs/html/inherit_graph_14.md5 | 1 + docs/html/inherit_graph_14.png | Bin 0 -> 2246 bytes docs/html/inherit_graph_2.md5 | 2 +- docs/html/inherit_graph_3.map | 6 +- docs/html/inherit_graph_3.md5 | 2 +- docs/html/inherit_graph_3.png | Bin 8261 -> 8631 bytes docs/html/inherit_graph_5.map | 2 +- docs/html/inherit_graph_5.md5 | 2 +- docs/html/inherit_graph_5.png | Bin 2991 -> 2771 bytes docs/html/inherit_graph_6.map | 2 +- docs/html/inherit_graph_6.md5 | 2 +- docs/html/inherit_graph_6.png | Bin 2151 -> 3042 bytes docs/html/inherit_graph_7.map | 2 +- docs/html/inherit_graph_7.md5 | 2 +- docs/html/inherit_graph_7.png | Bin 2246 -> 3298 bytes docs/html/inherit_graph_8.map | 3 + docs/html/inherit_graph_8.md5 | 1 + docs/html/inherit_graph_8.png | Bin 0 -> 3255 bytes docs/html/inherit_graph_9.map | 4 + docs/html/inherit_graph_9.md5 | 1 + docs/html/inherit_graph_9.png | Bin 0 -> 4815 bytes docs/html/inherits.html | 54 +- docs/html/menudata.js | 5 +- docs/html/search/all_2.js | 9 +- docs/html/search/all_3.js | 10 +- docs/html/search/all_4.js | 9 +- docs/html/search/all_5.js | 11 +- docs/html/search/all_6.js | 2 +- docs/html/search/all_7.js | 6 +- docs/html/search/all_8.js | 4 +- docs/html/search/all_9.js | 11 +- docs/html/search/all_a.js | 6 +- docs/html/search/all_b.js | 4 +- docs/html/search/all_c.js | 5 +- docs/html/search/all_d.html | 37 + docs/html/search/all_d.js | 5 + docs/html/search/all_e.html | 37 + docs/html/search/all_e.js | 7 + docs/html/search/classes_0.js | 6 +- docs/html/search/classes_1.js | 5 +- docs/html/search/classes_2.js | 3 +- docs/html/search/classes_3.js | 4 +- docs/html/search/classes_4.js | 3 +- docs/html/search/classes_5.js | 2 +- docs/html/search/classes_6.js | 7 +- docs/html/search/classes_7.js | 5 +- docs/html/search/classes_8.js | 3 +- docs/html/search/classes_9.html | 37 + docs/html/search/classes_9.js | 5 + docs/html/search/classes_a.html | 37 + docs/html/search/classes_a.js | 5 + docs/html/search/functions_0.js | 2 +- docs/html/search/functions_1.js | 2 +- docs/html/search/functions_2.js | 6 +- docs/html/search/functions_3.js | 10 +- docs/html/search/functions_4.js | 6 +- docs/html/search/functions_5.js | 2 +- docs/html/search/functions_6.js | 4 +- docs/html/search/functions_7.js | 4 +- docs/html/search/functions_8.js | 4 +- docs/html/search/searchdata.js | 16 +- docs/latex/annotated.tex | 14 +- ...rdinatedPartitionState__inherit__graph.md5 | 1 + ...rdinatedPartitionState__inherit__graph.pdf | Bin 0 -> 6958 bytes ...TITIONING_1_1CoordinatedPartitionState.tex | 66 + docs/latex/d0/df2/classCXXGRAPH_1_1Graph.tex | 92 +- .../classCXXGRAPH_1_1PARTITIONING_1_1HDRF.tex | 36 + docs/latex/d2/d3f/classCXXGRAPH_1_1Reader.tex | 4 +- docs/latex/d3/dd2/classCXXGRAPH_1_1Node.tex | 2 +- ...lassCXXGRAPH_1_1PARTITIONING_1_1Record.tex | 44 + .../d5/d2e/classCXXGRAPH_1_1Runnable.tex | 13 + .../structCXXGRAPH_1_1DialResult__struct.tex | 4 +- ...PARTITIONING_1_1Partition__coll__graph.md5 | 1 + ...PARTITIONING_1_1Partition__coll__graph.pdf | Bin 0 -> 6620 bytes ...H_1_1PARTITIONING_1_1PartitionerThread.tex | 22 + ...lassCXXGRAPH_1_1UndirectedWeightedEdge.tex | 5 +- docs/latex/d7/d2a/classCXXGRAPH_1_1Edge.tex | 2 +- docs/latex/d7/dde/classCXXGRAPH_1_1Writer.tex | 4 +- ...TITIONING_1_1Partition__inherit__graph.md5 | 1 + ...TITIONING_1_1Partition__inherit__graph.pdf | Bin 0 -> 6620 bytes ...XXGRAPH_1_1PARTITIONING_1_1Partitioner.tex | 16 + ...NING_1_1CoordinatedRecord__coll__graph.md5 | 1 + ...NING_1_1CoordinatedRecord__coll__graph.pdf | Bin 0 -> 6816 bytes ...H_1_1PARTITIONING_1_1HDRF__coll__graph.md5 | 1 + ...H_1_1PARTITIONING_1_1HDRF__coll__graph.pdf | Bin 0 -> 7302 bytes .../d9/d2f/classCXXGRAPH_1_1ThreadSafe.tex | 2 +- ...NING_1_1PartitionState__inherit__graph.md5 | 1 + ...NING_1_1PartitionState__inherit__graph.pdf | Bin 0 -> 6964 bytes .../classCXXGRAPH_1_1DirectedWeightedEdge.tex | 2 +- ...H_1_1PARTITIONING_1_1PartitioningStats.tex | 55 + .../da/da5/classCXXGRAPH_1_1Graph__TS.tex | 34 +- ...CoordinatedPartitionState__coll__graph.md5 | 1 + ...CoordinatedPartitionState__coll__graph.pdf | Bin 0 -> 6958 bytes ...PARTITIONING_1_1Record__inherit__graph.md5 | 1 + ...PARTITIONING_1_1Record__inherit__graph.pdf | Bin 0 -> 6810 bytes .../db/d54/classCXXGRAPH_1_1Weighted.tex | 2 +- ...assCXXGRAPH_1_1PARTITIONING_1_1Globals.tex | 37 + ...classCXXGRAPH_1_1Graph__inherit__graph.md5 | 2 +- ...classCXXGRAPH_1_1Graph__inherit__graph.pdf | Bin 7054 -> 7385 bytes ...ructCXXGRAPH_1_1DijkstraResult__struct.tex | 4 +- ...H_1_1PARTITIONING_1_1CoordinatedRecord.tex | 63 + ...sCXXGRAPH_1_1PARTITIONING_1_1Partition.tex | 77 + ...G_1_1PartitionStrategy__inherit__graph.md5 | 1 + ...G_1_1PartitionStrategy__inherit__graph.pdf | Bin 0 -> 7293 bytes ...G_1_1CoordinatedRecord__inherit__graph.md5 | 1 + ...G_1_1CoordinatedRecord__inherit__graph.pdf | Bin 0 -> 6816 bytes ...H_1_1PARTITIONING_1_1PartitionStrategy.tex | 23 + .../de/df5/classCXXGRAPH_1_1DirectedEdge.tex | 2 +- ..._1PARTITIONING_1_1HDRF__inherit__graph.md5 | 1 + ..._1PARTITIONING_1_1HDRF__inherit__graph.pdf | Bin 0 -> 7302 bytes ...RAPH_1_1PARTITIONING_1_1PartitionState.tex | 47 + .../d71/classCXXGRAPH_1_1UndirectedEdge.tex | 5 +- docs/latex/hierarchy.tex | 20 +- docs/latex/refman.tex | 14 +- 245 files changed, 10629 insertions(+), 2847 deletions(-) create mode 100644 docs/html/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.map create mode 100644 docs/html/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.md5 create mode 100644 docs/html/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.png create mode 100644 docs/html/d0/d70/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState.html create mode 100644 docs/html/d1/d0d/classCXXGRAPH_1_1PARTITIONING_1_1Globals-members.html create mode 100644 docs/html/d1/d63/classCXXGRAPH_1_1PARTITIONING_1_1HDRF.html create mode 100644 docs/html/d1/db4/UndirectedWeightedEdge_8hpp_source.html create mode 100644 docs/html/d2/d40/PartitioningStats_8hpp_source.html create mode 100644 docs/html/d2/de9/ThreadSafe_8hpp_source.html create mode 100644 docs/html/d2/df2/HDRF_8hpp_source.html create mode 100644 docs/html/d3/d4d/Typedef_8hpp_source.html create mode 100644 docs/html/d3/d6b/Record_8hpp_source.html create mode 100644 docs/html/d3/d91/Graph__TS_8hpp_source.html create mode 100644 docs/html/d3/de1/classCXXGRAPH_1_1PARTITIONING_1_1Record.html create mode 100644 docs/html/d4/d1e/ConstValue_8hpp_source.html create mode 100644 docs/html/d5/d2e/classCXXGRAPH_1_1Runnable.html create mode 100644 docs/html/d5/d36/PartitionAlgorithm_8hpp_source.html create mode 100644 docs/html/d5/d64/Globals_8hpp_source.html create mode 100644 docs/html/d5/d80/CXXGraph_8hpp_source.html create mode 100644 docs/html/d5/db2/UndirectedEdge_8hpp_source.html create mode 100644 docs/html/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.map create mode 100644 docs/html/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.md5 create mode 100644 docs/html/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.png create mode 100644 docs/html/d6/d85/DirectedEdge_8hpp_source.html create mode 100644 docs/html/d6/d85/PartitionStrategy_8hpp_source.html create mode 100644 docs/html/d7/d1b/classCXXGRAPH_1_1PARTITIONING_1_1PartitionerThread.html create mode 100644 docs/html/d7/d41/classCXXGRAPH_1_1PARTITIONING_1_1Partition-members.html create mode 100644 docs/html/d7/d59/CoordinatedRecord_8hpp_source.html create mode 100644 docs/html/d7/d70/classCXXGRAPH_1_1PARTITIONING_1_1PartitioningStats-members.html create mode 100644 docs/html/d7/dc6/Node_8hpp_source.html create mode 100644 docs/html/d7/de1/ConstString_8hpp_source.html create mode 100644 docs/html/d8/d2b/Runnable_8hpp_source.html create mode 100644 docs/html/d8/d4b/classCXXGRAPH_1_1PARTITIONING_1_1Partitioner-members.html create mode 100644 docs/html/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.map create mode 100644 docs/html/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.md5 create mode 100644 docs/html/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.png create mode 100644 docs/html/d8/d6d/classCXXGRAPH_1_1PARTITIONING_1_1Partitioner.html create mode 100644 docs/html/d8/d91/Partitioner_8hpp_source.html create mode 100644 docs/html/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.map create mode 100644 docs/html/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.md5 create mode 100644 docs/html/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.png create mode 100644 docs/html/d9/d11/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__coll__graph.map create mode 100644 docs/html/d9/d11/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__coll__graph.md5 create mode 100644 docs/html/d9/d11/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__coll__graph.png create mode 100644 docs/html/d9/da1/classCXXGRAPH_1_1PARTITIONING_1_1PartitionerThread-members.html create mode 100644 docs/html/da/d0e/PartitionerThread_8hpp_source.html create mode 100644 docs/html/da/d21/classCXXGRAPH_1_1PARTITIONING_1_1PartitionState__inherit__graph.map create mode 100644 docs/html/da/d21/classCXXGRAPH_1_1PARTITIONING_1_1PartitionState__inherit__graph.md5 create mode 100644 docs/html/da/d21/classCXXGRAPH_1_1PARTITIONING_1_1PartitionState__inherit__graph.png create mode 100644 docs/html/da/d5d/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord-members.html create mode 100644 docs/html/da/d71/classCXXGRAPH_1_1PARTITIONING_1_1PartitioningStats.html create mode 100644 docs/html/da/de0/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__coll__graph.map create mode 100644 docs/html/da/de0/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__coll__graph.md5 create mode 100644 docs/html/da/de0/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__coll__graph.png create mode 100644 docs/html/da/dea/DirectedWeightedEdge_8hpp_source.html create mode 100644 docs/html/db/d24/classCXXGRAPH_1_1PARTITIONING_1_1PartitionStrategy-members.html create mode 100644 docs/html/db/d3e/classCXXGRAPH_1_1PARTITIONING_1_1Record__inherit__graph.map create mode 100644 docs/html/db/d3e/classCXXGRAPH_1_1PARTITIONING_1_1Record__inherit__graph.md5 create mode 100644 docs/html/db/d3e/classCXXGRAPH_1_1PARTITIONING_1_1Record__inherit__graph.png create mode 100644 docs/html/db/d5b/classCXXGRAPH_1_1PARTITIONING_1_1Globals.html create mode 100644 docs/html/dc/d4d/Partition_8hpp_source.html create mode 100644 docs/html/dc/d50/PartitionState_8hpp_source.html create mode 100644 docs/html/dc/d91/Edge_8hpp_source.html create mode 100644 docs/html/dd/d69/classCXXGRAPH_1_1PARTITIONING_1_1HDRF-members.html create mode 100644 docs/html/de/d1d/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord.html create mode 100644 docs/html/de/d42/classCXXGRAPH_1_1PARTITIONING_1_1PartitionState-members.html create mode 100644 docs/html/de/d59/classCXXGRAPH_1_1PARTITIONING_1_1Partition.html create mode 100644 docs/html/de/d6f/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState-members.html create mode 100644 docs/html/de/d82/classCXXGRAPH_1_1PARTITIONING_1_1PartitionStrategy__inherit__graph.map create mode 100644 docs/html/de/d82/classCXXGRAPH_1_1PARTITIONING_1_1PartitionStrategy__inherit__graph.md5 create mode 100644 docs/html/de/d82/classCXXGRAPH_1_1PARTITIONING_1_1PartitionStrategy__inherit__graph.png create mode 100644 docs/html/de/d82/classCXXGRAPH_1_1Runnable-members.html create mode 100644 docs/html/de/d93/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__inherit__graph.map create mode 100644 docs/html/de/d93/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__inherit__graph.md5 create mode 100644 docs/html/de/d93/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__inherit__graph.png create mode 100644 docs/html/de/dac/Writer_8hpp_source.html create mode 100644 docs/html/de/ddc/classCXXGRAPH_1_1PARTITIONING_1_1Record-members.html create mode 100644 docs/html/de/de1/CoordinatedPartitionState_8hpp_source.html create mode 100644 docs/html/de/deb/classCXXGRAPH_1_1PARTITIONING_1_1PartitionStrategy.html create mode 100644 docs/html/df/d03/Reader_8hpp_source.html create mode 100644 docs/html/df/d27/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__inherit__graph.map create mode 100644 docs/html/df/d27/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__inherit__graph.md5 create mode 100644 docs/html/df/d27/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__inherit__graph.png create mode 100644 docs/html/df/d6f/classCXXGRAPH_1_1PARTITIONING_1_1PartitionState.html create mode 100644 docs/html/df/dd3/Weighted_8hpp_source.html create mode 100644 docs/html/dir_5a1c299fe071d2684abbfdc4f5a71058.html create mode 100644 docs/html/dir_664b94fe24dd8b5b31bd73b721ea4656.html create mode 100644 docs/html/dir_701c8f06b1c05dfef7c59ec059aa05bd.html create mode 100644 docs/html/dir_b647303d7dac632cf2e2685370b563a8.html create mode 100644 docs/html/dir_c632fc99025ef8bfa3e097f773c00de6.html create mode 100644 docs/html/dir_d192150ed164ec0bf3db1023d7b06f0a.html create mode 100644 docs/html/inherit_graph_10.map create mode 100644 docs/html/inherit_graph_10.md5 create mode 100644 docs/html/inherit_graph_10.png create mode 100644 docs/html/inherit_graph_11.map create mode 100644 docs/html/inherit_graph_11.md5 create mode 100644 docs/html/inherit_graph_11.png create mode 100644 docs/html/inherit_graph_12.map create mode 100644 docs/html/inherit_graph_12.md5 create mode 100644 docs/html/inherit_graph_12.png create mode 100644 docs/html/inherit_graph_13.map create mode 100644 docs/html/inherit_graph_13.md5 create mode 100644 docs/html/inherit_graph_13.png create mode 100644 docs/html/inherit_graph_14.map create mode 100644 docs/html/inherit_graph_14.md5 create mode 100644 docs/html/inherit_graph_14.png create mode 100644 docs/html/inherit_graph_8.map create mode 100644 docs/html/inherit_graph_8.md5 create mode 100644 docs/html/inherit_graph_8.png create mode 100644 docs/html/inherit_graph_9.map create mode 100644 docs/html/inherit_graph_9.md5 create mode 100644 docs/html/inherit_graph_9.png create mode 100644 docs/html/search/all_d.html create mode 100644 docs/html/search/all_d.js create mode 100644 docs/html/search/all_e.html create mode 100644 docs/html/search/all_e.js create mode 100644 docs/html/search/classes_9.html create mode 100644 docs/html/search/classes_9.js create mode 100644 docs/html/search/classes_a.html create mode 100644 docs/html/search/classes_a.js create mode 100644 docs/latex/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.md5 create mode 100644 docs/latex/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.pdf create mode 100644 docs/latex/d0/d70/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState.tex create mode 100644 docs/latex/d1/d63/classCXXGRAPH_1_1PARTITIONING_1_1HDRF.tex create mode 100644 docs/latex/d3/de1/classCXXGRAPH_1_1PARTITIONING_1_1Record.tex create mode 100644 docs/latex/d5/d2e/classCXXGRAPH_1_1Runnable.tex create mode 100644 docs/latex/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.md5 create mode 100644 docs/latex/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.pdf create mode 100644 docs/latex/d7/d1b/classCXXGRAPH_1_1PARTITIONING_1_1PartitionerThread.tex create mode 100644 docs/latex/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.md5 create mode 100644 docs/latex/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.pdf create mode 100644 docs/latex/d8/d6d/classCXXGRAPH_1_1PARTITIONING_1_1Partitioner.tex create mode 100644 docs/latex/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.md5 create mode 100644 docs/latex/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.pdf create mode 100644 docs/latex/d9/d11/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__coll__graph.md5 create mode 100644 docs/latex/d9/d11/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__coll__graph.pdf create mode 100644 docs/latex/da/d21/classCXXGRAPH_1_1PARTITIONING_1_1PartitionState__inherit__graph.md5 create mode 100644 docs/latex/da/d21/classCXXGRAPH_1_1PARTITIONING_1_1PartitionState__inherit__graph.pdf create mode 100644 docs/latex/da/d71/classCXXGRAPH_1_1PARTITIONING_1_1PartitioningStats.tex create mode 100644 docs/latex/da/de0/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__coll__graph.md5 create mode 100644 docs/latex/da/de0/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__coll__graph.pdf create mode 100644 docs/latex/db/d3e/classCXXGRAPH_1_1PARTITIONING_1_1Record__inherit__graph.md5 create mode 100644 docs/latex/db/d3e/classCXXGRAPH_1_1PARTITIONING_1_1Record__inherit__graph.pdf create mode 100644 docs/latex/db/d5b/classCXXGRAPH_1_1PARTITIONING_1_1Globals.tex create mode 100644 docs/latex/de/d1d/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord.tex create mode 100644 docs/latex/de/d59/classCXXGRAPH_1_1PARTITIONING_1_1Partition.tex create mode 100644 docs/latex/de/d82/classCXXGRAPH_1_1PARTITIONING_1_1PartitionStrategy__inherit__graph.md5 create mode 100644 docs/latex/de/d82/classCXXGRAPH_1_1PARTITIONING_1_1PartitionStrategy__inherit__graph.pdf create mode 100644 docs/latex/de/d93/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__inherit__graph.md5 create mode 100644 docs/latex/de/d93/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__inherit__graph.pdf create mode 100644 docs/latex/de/deb/classCXXGRAPH_1_1PARTITIONING_1_1PartitionStrategy.tex create mode 100644 docs/latex/df/d27/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__inherit__graph.md5 create mode 100644 docs/latex/df/d27/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__inherit__graph.pdf create mode 100644 docs/latex/df/d6f/classCXXGRAPH_1_1PARTITIONING_1_1PartitionState.tex diff --git a/docs/html/annotated.html b/docs/html/annotated.html index d093615e2..ce20977c0 100644 --- a/docs/html/annotated.html +++ b/docs/html/annotated.html @@ -69,24 +69,35 @@
Here are the classes, structs, unions and interfaces with brief descriptions:
-
[detail level 12]
+
[detail level 123]
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + +
 NCXXGRAPH
 CNode
 CEdge
 CDirectedEdge
 CUndirectedEdge
 CDirectedWeightedEdge
 CUndirectedWeightedEdge
 CGraphClass that implement the Graph. ( This class is not Thread Safe )
 CPartition
 CWriter
 CReader
 CDijkstraResult_structStruct that contains the information about Dijsktra's Algorithm results
 CDialResult_structStruct that contains the information about Dijsktra's Algorithm results
 CPartitioningStats_structStruct that contains the information about the partitioning statistics
 CWeighted
 CThreadSafe
 CGraph_TSClass that implement the Thread Safe Graph
 NPARTITIONING
 CPartition
 CCoordinatedPartitionState
 CCoordinatedRecord
 CHDRF
 CPartitioner
 CPartitionerThread
 CPartitioningStats
 CPartitionState
 CPartitionStrategy
 CRecord
 CGlobals
 CUndirectedEdge
 CDirectedEdge
 CUndirectedWeightedEdge
 CDirectedWeightedEdge
 CEdge
 CWeighted
 CGraphClass that implement the Graph. ( This class is not Thread Safe )
 CGraph_TSClass that implement the Thread Safe Graph
 CNode
 CReader
 CRunnable
 CThreadSafe
 CDijkstraResult_structStruct that contains the information about Dijsktra's Algorithm results
 CDialResult_structStruct that contains the information about Dijsktra's Algorithm results
 CWriter
diff --git a/docs/html/classes.html b/docs/html/classes.html index 1f67dd646..a83a3f930 100644 --- a/docs/html/classes.html +++ b/docs/html/classes.html @@ -68,26 +68,32 @@
Class Index
-
D | E | G | N | P | R | T | U | W
+
C | D | E | G | H | N | P | R | T | U | W
+
C
+
CoordinatedPartitionState (CXXGRAPH::PARTITIONING)
CoordinatedRecord (CXXGRAPH::PARTITIONING)
+
D
DialResult_struct (CXXGRAPH)
DijkstraResult_struct (CXXGRAPH)
DirectedEdge (CXXGRAPH)
DirectedWeightedEdge (CXXGRAPH)
-
+
E
Edge (CXXGRAPH)
-
+
G
-
Graph (CXXGRAPH)
Graph_TS (CXXGRAPH)
+
Globals (CXXGRAPH::PARTITIONING)
Graph (CXXGRAPH)
Graph_TS (CXXGRAPH)
+
+
H
+
HDRF (CXXGRAPH::PARTITIONING)
N
Node (CXXGRAPH)
P
-
Partition (CXXGRAPH)
PartitioningStats_struct (CXXGRAPH)
+
Partition (CXXGRAPH::PARTITIONING)
Partitioner (CXXGRAPH::PARTITIONING)
PartitionerThread (CXXGRAPH::PARTITIONING)
PartitioningStats (CXXGRAPH::PARTITIONING)
PartitionState (CXXGRAPH::PARTITIONING)
PartitionStrategy (CXXGRAPH::PARTITIONING)
R
-
Reader (CXXGRAPH)
+
Reader (CXXGRAPH)
Record (CXXGRAPH::PARTITIONING)
Runnable (CXXGRAPH)
T
ThreadSafe (CXXGRAPH)
diff --git a/docs/html/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.map b/docs/html/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.map new file mode 100644 index 000000000..6be14b3bc --- /dev/null +++ b/docs/html/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.map @@ -0,0 +1,4 @@ + + + + diff --git a/docs/html/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.md5 b/docs/html/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.md5 new file mode 100644 index 000000000..519875feb --- /dev/null +++ b/docs/html/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.md5 @@ -0,0 +1 @@ +7b2859755e79dd0c86a1a9919e3e96cc \ No newline at end of file diff --git a/docs/html/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.png b/docs/html/d0/d69/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState__inherit__graph.png new file mode 100644 index 0000000000000000000000000000000000000000..3d8e9a055d931673ec906c25652c497d1c852db0 GIT binary patch literal 7372 zcmc&(g;y2-wm&LLiiDJa#F0`;KtNKuLzM3Bl({AR!IXNF#6i zyLa97)_s4#8<#K)XM*qE`%@F9tSEI8>kbwIfw(CnEv^FJC*gl2##Q)Q)hgWt-)~tTKq_? zD9_Z}?`pNuOj!x>)u;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l*DB_@#?XPIDLWTr&n zYdCD0G&nx44vDsm47|?3;smT)Ut5!rm31P&Vz-`Gg18Ykh z?y@!n9F_y-9l}O{T5N3W=dUzO2F;$x$vt3XWaQ;NhHi(bw7Iz%ZY0*neV0D&WOXnb zA|!Nl^veaROAziI)wWZ?ul*lhJsR})BYFq!-}9!Oy?sV(EWz#DTo8(n6es~2fK@;P;e5FF72$OLsgfk~E$qlfJ8VyE>M z5D?_>pcID3#)zwtz72EDp7*$MA7he2JHY!hDk1Nkg9Dukv)<+)ba>dZR&rv^O0uTd z$ueUp9i8cewP9GLm#MY_5)u;a?d>x&GoT9K&A`N^`YXg=$9@x7MO5!U@74bAj(h#J z#XomNFihGYy@yjfwB0Rs;UTjVZY|pP!VPw*n8bYTNzpj?nl}D-Ec(|jhFo4_EM3{& U7Yo9L*OLet2}SW@QG>w$0Y71QjsO4v literal 0 HcmV?d00001 diff --git a/docs/html/d0/d70/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState.html b/docs/html/d0/d70/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState.html new file mode 100644 index 000000000..6ff1e1aff --- /dev/null +++ b/docs/html/d0/d70/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedPartitionState.html @@ -0,0 +1,149 @@ + + + + + + + +CXXGraph: CXXGRAPH::PARTITIONING::CoordinatedPartitionState< T > Class Template Reference + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
CXXGRAPH::PARTITIONING::CoordinatedPartitionState< T > Class Template Reference
+
+
+
+Inheritance diagram for CXXGRAPH::PARTITIONING::CoordinatedPartitionState< T >:
+
+
Inheritance graph
+ + + + +
[legend]
+
+Collaboration diagram for CXXGRAPH::PARTITIONING::CoordinatedPartitionState< T >:
+
+
Collaboration graph
+ + + + +
[legend]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

CoordinatedPartitionState (Globals &G)
 
+Record< T > & getRecord (int x)
 
+int getMachineLoad (int m)
 
+void incrementMachineLoad (int m, Edge< T > &e)
 
+int getMinLoad ()
 
+int getMaxLoad ()
 
+std::vector< int > getMachines_load ()
 
+int getTotalReplicas ()
 
+int getNumVertices ()
 
+std::set< int > getVertexIds ()
 
+void incrementMachineLoadVertices (int m)
 
+std::vector< int > getMachines_loadVertices ()
 
- Public Member Functions inherited from CXXGRAPH::PARTITIONING::PartitionState< T >
+virtual void incrementMachineLoad (int m, Edge< T > e)=0
 
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/docs/html/d0/df2/classCXXGRAPH_1_1Graph.html b/docs/html/d0/df2/classCXXGRAPH_1_1Graph.html index 48826b29a..99b98c26c 100644 --- a/docs/html/d0/df2/classCXXGRAPH_1_1Graph.html +++ b/docs/html/d0/df2/classCXXGRAPH_1_1Graph.html @@ -69,7 +69,6 @@
@@ -87,34 +86,12 @@
Inheritance graph
- - - + + +
[legend]
- - - - - - - - - - - -

-Public Types

enum  E_InputOutputFormat { STANDARD_CSV -, STANDARD_TSV -, OUT_1 -, OUT_2 - }
 Specify the Input/Output format of the Graph for Import/Export functions. More...
 
enum  E_PartitionAlgorithm { GREEDY_VC -, ALG_1 -, ALG_2 - }
 Specify the Partition Algorithm. More...
 
-typedef E_InputOutputFormat InputOutputFormat
 
-typedef E_PartitionAlgorithm PartitionAlgorithm
 
- + - + - - - + + +

Public Member Functions

@@ -163,15 +140,15 @@
virtual const DialResult dial (const Node< T > &source, int maxWeight) const
 This function write the graph in an output file Note: No Thread Safe. More...
 
virtual int writeToFile (InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) const
virtual int writeToFile (InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) const
 This function write the graph in an output file Note: No Thread Safe. More...
 
virtual int readFromFile (InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool readNodeFeat=false, bool readEdgeWeight=false)
virtual int readFromFile (InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool readNodeFeat=false, bool readEdgeWeight=false)
 This function read the graph from an input file Note: No Thread Safe. More...
 
virtual PartitionMap< T > partitionGraph (PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const
 This function partition a graph in a set of partitions Note: No Thread Safe. More...
 
virtual PartitionMap< T > partitionGraph (PARTITIONING::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const
 This function partition a graph in a set of partitions Note: No Thread Safe. More...
 
@@ -187,54 +164,7 @@ class CXXGRAPH::Graph< T >

Class that implement the Graph. ( This class is not Thread Safe )

-

Member Enumeration Documentation

- -

◆ E_InputOutputFormat

- -
-
-
-template<typename T >
-

Friends

- - - -
enum CXXGRAPH::Graph::E_InputOutputFormat
-
- -

Specify the Input/Output format of the Graph for Import/Export functions.

- - - -
Enumerator
STANDARD_CSV 

A standard csv format.

-
STANDARD_TSV 

A standard tsv format.

-
- -
-
- -

◆ E_PartitionAlgorithm

- -
-
-
-template<typename T >
- - - - -
enum CXXGRAPH::Graph::E_PartitionAlgorithm
-
- -

Specify the Partition Algorithm.

- - -
Enumerator
GREEDY_VC 

A Greedy Vertex-Cut Algorithm.

-
- -
-
-

Member Function Documentation

+

Member Function Documentation

◆ addEdge()

@@ -648,8 +578,8 @@

-

◆ partitionGraph()

+ +

◆ partitionGraph()

@@ -662,7 +592,7 @@

PartitionMap< T > CXXGRAPH::Graph< T >::partitionGraph ( - PartitionAlgorithm  + PARTITIONING::PartitionAlgorithm  algorithm, @@ -694,6 +624,8 @@

Returns
The partiton Map of the partitioned graph
+

Reimplemented in CXXGRAPH::Graph_TS< T >.

+

@@ -710,7 +642,7 @@

int CXXGRAPH::Graph< T >::readFromFile ( - InputOutputFormat  + InputOutputFormat  format = InputOutputFormat::STANDARD_CSV, @@ -770,6 +702,8 @@

Returns
0 if all OK, else return a negative value
+

Reimplemented in CXXGRAPH::Graph_TS< T >.

+ @@ -862,7 +796,7 @@

int CXXGRAPH::Graph< T >::writeToFile ( - InputOutputFormat  + InputOutputFormat  format = InputOutputFormat::STANDARD_CSV, @@ -922,10 +856,12 @@

Returns
0 if all OK, else return a negative value
+

Reimplemented in CXXGRAPH::Graph_TS< T >.

+
The documentation for this class was generated from the following file: diff --git a/docs/html/d1/d0d/classCXXGRAPH_1_1PARTITIONING_1_1Globals-members.html b/docs/html/d1/d0d/classCXXGRAPH_1_1PARTITIONING_1_1Globals-members.html new file mode 100644 index 000000000..d1f5f4601 --- /dev/null +++ b/docs/html/d1/d0d/classCXXGRAPH_1_1PARTITIONING_1_1Globals-members.html @@ -0,0 +1,93 @@ + + + + + + + +CXXGraph: Member List + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
CXXGRAPH::PARTITIONING::Globals Member List
+
+
+ +

This is the complete list of members for CXXGRAPH::PARTITIONING::Globals, including all inherited members.

+ + + + + + + + + + +
Globals(int numberOfPartiton, double lambda=1, PartitionAlgorithm algorithm=PartitionAlgorithm::HDRF_ALG, unsigned int threads=std::thread::hardware_concurrency()) (defined in CXXGRAPH::PARTITIONING::Globals)CXXGRAPH::PARTITIONING::Globalsinline
lambda (defined in CXXGRAPH::PARTITIONING::Globals)CXXGRAPH::PARTITIONING::Globals
numberOfPartition (defined in CXXGRAPH::PARTITIONING::Globals)CXXGRAPH::PARTITIONING::Globals
partitionStategy (defined in CXXGRAPH::PARTITIONING::Globals)CXXGRAPH::PARTITIONING::Globals
PLACES (defined in CXXGRAPH::PARTITIONING::Globals)CXXGRAPH::PARTITIONING::Globals
print() (defined in CXXGRAPH::PARTITIONING::Globals)CXXGRAPH::PARTITIONING::Globals
SLEEP_LIMIT (defined in CXXGRAPH::PARTITIONING::Globals)CXXGRAPH::PARTITIONING::Globals
threads (defined in CXXGRAPH::PARTITIONING::Globals)CXXGRAPH::PARTITIONING::Globals
~Globals() (defined in CXXGRAPH::PARTITIONING::Globals)CXXGRAPH::PARTITIONING::Globalsinline
+ + + + diff --git a/docs/html/d1/d63/classCXXGRAPH_1_1PARTITIONING_1_1HDRF.html b/docs/html/d1/d63/classCXXGRAPH_1_1PARTITIONING_1_1HDRF.html new file mode 100644 index 000000000..c15fbaffd --- /dev/null +++ b/docs/html/d1/d63/classCXXGRAPH_1_1PARTITIONING_1_1HDRF.html @@ -0,0 +1,115 @@ + + + + + + + +CXXGraph: CXXGRAPH::PARTITIONING::HDRF< T > Class Template Reference + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
CXXGRAPH::PARTITIONING::HDRF< T > Class Template Reference
+
+
+
+Inheritance diagram for CXXGRAPH::PARTITIONING::HDRF< T >:
+
+
Inheritance graph
+ + + + +
[legend]
+
+Collaboration diagram for CXXGRAPH::PARTITIONING::HDRF< T >:
+
+
Collaboration graph
+ + + + +
[legend]
+ + + + + + +

+Public Member Functions

HDRF (Globals G)
 
+void performStep (Edge< T > &e, PartitionState< T > &Sstate)
 
+
The documentation for this class was generated from the following file:
    +
  • /github/workspace/include/Partitioning/HDRF.hpp
  • +
+
+ + + + diff --git a/docs/html/d1/db4/UndirectedWeightedEdge_8hpp_source.html b/docs/html/d1/db4/UndirectedWeightedEdge_8hpp_source.html new file mode 100644 index 000000000..2d9ca709a --- /dev/null +++ b/docs/html/d1/db4/UndirectedWeightedEdge_8hpp_source.html @@ -0,0 +1,197 @@ + + + + + + + +CXXGraph: /github/workspace/include/Edge/UndirectedWeightedEdge.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
UndirectedWeightedEdge.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __UNDIRECTEDWEIGHTEDEDGE_H__
+
21 #define __UNDIRECTEDWEIGHTEDEDGE_H__
+
22 
+
23 #pragma once
+
24 
+
25 #include "UndirectedEdge.hpp"
+
26 #include "Weighted.hpp"
+
27 
+
28 namespace CXXGRAPH
+
29 {
+
30  //Foward Declaration
+
31  template <typename T>
+
32  class DirectedWeightedEdge;
+
33 
+
34  template <typename T>
+
35  class UndirectedWeightedEdge;
+
36 
+
37  // ostream operator
+
38  template <typename T>
+
39  std::ostream &operator<<(std::ostream &o, const UndirectedWeightedEdge<T> &edge);
+
40 
+
41  template <typename T>
+ +
43  {
+
44  public:
+
45  UndirectedWeightedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2, const double weight);
+
46  UndirectedWeightedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair, const double weight);
+
47  UndirectedWeightedEdge(const UndirectedEdge<T> &edge, const double weight);
+
48  UndirectedWeightedEdge(const Edge<T> &edge, const double weight);
+ +
50  UndirectedWeightedEdge(const Edge<T> &edge);
+ +
52  virtual ~UndirectedWeightedEdge() = default;
+
53  const std::optional<bool> isWeighted() const override;
+
54  //operator
+
55  explicit operator DirectedWeightedEdge<T>() const { return DirectedWeightedEdge<T>(Edge<T>::getId(), Edge<T>::getNodePair(), Weighted::getWeight()); }
+
56 
+
57  friend std::ostream &operator<<<>(std::ostream &os, const UndirectedWeightedEdge<T> &edge);
+
58  };
+
59 
+
60  template <typename T>
+
61  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2, const double weight) : UndirectedEdge<T>(id, node1, node2), Weighted(weight)
+
62  {
+
63  }
+
64 
+
65  template <typename T>
+
66  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair, const double weight) : UndirectedEdge<T>(id, nodepair), Weighted(weight)
+
67  {
+
68  }
+
69 
+
70  template <typename T>
+
71  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const UndirectedEdge<T> &edge, const double weight) : UndirectedEdge<T>(edge), Weighted(weight)
+
72  {
+
73  }
+
74 
+
75  template <typename T>
+
76  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const Edge<T> &edge, const double weight) : UndirectedEdge<T>(edge), Weighted(weight)
+
77  {
+
78  }
+
79 
+
80  template <typename T>
+
81  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const UndirectedEdge<T> &edge) : UndirectedEdge<T>(edge), Weighted()
+
82  {
+
83  }
+
84 
+
85  template <typename T>
+
86  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const Edge<T> &edge) : UndirectedEdge<T>(edge), Weighted()
+
87  {
+
88  }
+
89 
+
90  template <typename T>
+
91  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const DirectedWeightedEdge<T> &edge) : UndirectedEdge<T>(edge), Weighted(edge.getWeight())
+
92  {
+
93  }
+
94 
+
95  template <typename T>
+
96  const std::optional<bool> UndirectedWeightedEdge<T>::isWeighted() const
+
97  {
+
98  return true;
+
99  }
+
100 
+
101  template <typename T>
+
102  std::ostream &operator<<(std::ostream &os, const UndirectedWeightedEdge<T> &edge)
+
103  {
+
104  os << "((Node: " << edge.getNode1().getId() << ")) <----- |Edge: #" << edge.getId() << " W:" << edge.getWeight() << "|-----> ((Node: " << edge.getNode2().getId() << "))";
+
105  return os;
+
106  }
+
107 
+
108 }
+
109 
+
110 #endif // __UNDIRECTEDWEIGHTEDEDGE_H__
+
Definition: DirectedWeightedEdge.hpp:42
+
Definition: Edge.hpp:40
+
Definition: Node.hpp:35
+
Definition: UndirectedEdge.hpp:39
+
Definition: UndirectedWeightedEdge.hpp:43
+
Definition: Weighted.hpp:28
+
+ + + + diff --git a/docs/html/d2/d3f/classCXXGRAPH_1_1Reader.html b/docs/html/d2/d3f/classCXXGRAPH_1_1Reader.html index 3790c7a9d..5766f52b6 100644 --- a/docs/html/d2/d3f/classCXXGRAPH_1_1Reader.html +++ b/docs/html/d2/d3f/classCXXGRAPH_1_1Reader.html @@ -75,14 +75,14 @@
-

#include <Graph.hpp>

+

#include <Reader.hpp>

Detailed Description

template<typename T>
class CXXGRAPH::Reader< T >

Interface to implement for a custom reader.


The documentation for this class was generated from the following file:
diff --git a/docs/html/d2/d40/PartitioningStats_8hpp_source.html b/docs/html/d2/d40/PartitioningStats_8hpp_source.html new file mode 100644 index 000000000..b96623757 --- /dev/null +++ b/docs/html/d2/d40/PartitioningStats_8hpp_source.html @@ -0,0 +1,151 @@ + + + + + + + +CXXGraph: /github/workspace/include/Partitioning/PartitioningStats.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
PartitioningStats.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __PARTITIONINGSTATS_H__
+
21 #define __PARTITIONINGSTATS_H__
+
22 
+
23 #include <iostream>
+
24 #include "Utility/Typedef.hpp"
+
25 namespace CXXGRAPH
+
26 {
+
27  namespace PARTITIONING
+
28  {
+ +
30  {
+
31  public:
+
32  unsigned int numberOfPartitions; // The number of Partitions
+
33  unsigned int numberOfNodes; // The number of Nodes
+
34  unsigned int replicatedNodesCount; // The number of Nodes that are replicated
+
35  unsigned int numberOfEdges; // The number of edges
+
36  unsigned int replicatedEdgesCount; // The number of edges that are replicated
+
37  unsigned int maxEdgesLoad; // Maximum edges load of the partitions
+
38  unsigned int minEdgesLoad; // Minimun edges load of the partitions
+
39  unsigned int maxNodesLoad; // Maximum nodes load of the partitions
+
40  unsigned int minNodesLoad; // Minimun nodes load of the partitions
+
41  double balanceEdgesFactor; // The balance edges factor of the partitions (maxEdgesLoad - minEdgesLoad) / (maxEdgesLoad), 0 is the optimal partitioning
+
42  double balanceNodesFactor; // The balance edges factor of the partitions (maxNodesLoad - minNodesLoad) / (maxNodesLoad), 0 is the optimal partitioning
+
43  double nodesReplicationFactor; // The replication factor of the Nodes (replicatedNodesCount / numberOfNodes), 1 is the optimal partitioning
+
44  double edgesReplicationFactor; // The replication factor of the edges (replicatedEdgesCount / numberOfEdges), 1 is the optimal partitioning
+
45 
+
46  friend std::ostream &operator<<(std::ostream &os, const PartitioningStats &partitionStats)
+
47  {
+
48  os << "Partitioning Stats:\n";
+
49  os << "\tNumber of Partitions: " << partitionStats.numberOfPartitions << "\n";
+
50  os << "\tNumber of Nodes: " << partitionStats.numberOfNodes << "\n";
+
51  os << "\tNumber of Edges: " << partitionStats.numberOfEdges << "\n";
+
52  os << "\tNumber of Nodes Replica: " << partitionStats.replicatedNodesCount << "\n";
+
53  os << "\tNumber of Edges Replica: " << partitionStats.replicatedEdgesCount << "\n";
+
54  os << "\tNodes Replication Factor: " << partitionStats.nodesReplicationFactor << "\n";
+
55  os << "\tEdges Replication Factor: " << partitionStats.edgesReplicationFactor << "\n";
+
56  os << "\tMax Edges Load: " << partitionStats.maxEdgesLoad << "\n";
+
57  os << "\tMin Edges Load: " << partitionStats.minEdgesLoad << "\n";
+
58  os << "\tBalance Edges Factor: " << partitionStats.balanceEdgesFactor << "\n";
+
59  os << "\tMax Nodes Load: " << partitionStats.maxNodesLoad << "\n";
+
60  os << "\tMin Nodes Load: " << partitionStats.minNodesLoad << "\n";
+
61  os << "\tBalance Nodes Factor: " << partitionStats.balanceNodesFactor << "\n";
+
62  return os;
+
63  }
+
64  };
+
65  }
+
66 
+
67 }
+
68 
+
69 #endif // __PARTITIONINGSTATS_H__
+
Definition: PartitioningStats.hpp:30
+
+ + + + diff --git a/docs/html/d2/d6c/classCXXGRAPH_1_1Graph__TS-members.html b/docs/html/d2/d6c/classCXXGRAPH_1_1Graph__TS-members.html index f0305ea7c..6df1169f5 100644 --- a/docs/html/d2/d6c/classCXXGRAPH_1_1Graph__TS-members.html +++ b/docs/html/d2/d6c/classCXXGRAPH_1_1Graph__TS-members.html @@ -76,14 +76,10 @@

This is the complete list of members for CXXGRAPH::Graph_TS< T >, including all inherited members.

- - - - @@ -94,26 +90,16 @@ - - - - - - - - - - - - - - - - + + + + + +
addEdge(const Edge< T > *edge) overrideCXXGRAPH::Graph_TS< T >virtual
ALG_1 enum value (defined in CXXGRAPH::Graph< T >)CXXGRAPH::Graph< T >
ALG_2 enum value (defined in CXXGRAPH::Graph< T >)CXXGRAPH::Graph< T >
breadth_first_search(const Node< T > &start) const overrideCXXGRAPH::Graph_TS< T >virtual
depth_first_search(const Node< T > &start) const overrideCXXGRAPH::Graph_TS< T >virtual
dial(const Node< T > &source, int maxWeight) const overrideCXXGRAPH::Graph_TS< T >virtual
dijkstra(const Node< T > &source, const Node< T > &target) const overrideCXXGRAPH::Graph_TS< T >virtual
E_InputOutputFormat enum nameCXXGRAPH::Graph< T >
E_PartitionAlgorithm enum nameCXXGRAPH::Graph< T >
getAdjMatrix() const overrideCXXGRAPH::Graph_TS< T >virtual
getEdge(unsigned long edgeId) const overrideCXXGRAPH::Graph_TS< T >virtual
getEdgeSet() const overrideCXXGRAPH::Graph_TS< T >virtual
Graph_TS()=default (defined in CXXGRAPH::Graph_TS< T >)CXXGRAPH::Graph_TS< T >
Graph_TS(const std::list< const Edge< T > * > &edgeSet) (defined in CXXGRAPH::Graph_TS< T >)CXXGRAPH::Graph_TS< T >
Graph_TS(const Graph< T > &graph) (defined in CXXGRAPH::Graph_TS< T >)CXXGRAPH::Graph_TS< T >
GREEDY_VC enum valueCXXGRAPH::Graph< T >
InputOutputFormat typedef (defined in CXXGRAPH::Graph< T >)CXXGRAPH::Graph< T >
isCyclicDirectedGraphBFS() const overrideCXXGRAPH::Graph_TS< T >virtual
isCyclicDirectedGraphDFS() const overrideCXXGRAPH::Graph_TS< T >virtual
isDirectedGraph() const overrideCXXGRAPH::Graph_TS< T >virtual
mutex (defined in CXXGRAPH::ThreadSafe)CXXGRAPH::ThreadSafemutableprotected
OUT_1 enum value (defined in CXXGRAPH::Graph< T >)CXXGRAPH::Graph< T >
OUT_2 enum value (defined in CXXGRAPH::Graph< T >)CXXGRAPH::Graph< T >
PartitionAlgorithm typedef (defined in CXXGRAPH::Graph< T >)CXXGRAPH::Graph< T >
partitionGraph(typename Graph< T >::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const overrideCXXGRAPH::Graph_TS< T >
CXXGRAPH::Graph::partitionGraph(PartitionAlgorithm algorithm, unsigned int numberOfPartitions) constCXXGRAPH::Graph< T >virtual
readFromFile(typename Graph< T >::InputOutputFormat format=Graph< T >::InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool readNodeFeat=false, bool readEdgeWeight=false) overrideCXXGRAPH::Graph_TS< T >
CXXGRAPH::Graph::readFromFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool readNodeFeat=false, bool readEdgeWeight=false)CXXGRAPH::Graph< T >virtual
releaseLock() const (defined in CXXGRAPH::ThreadSafe)CXXGRAPH::ThreadSafeinline
removeEdge(unsigned long edgeId) overrideCXXGRAPH::Graph_TS< T >virtual
setEdgeSet(std::list< const Edge< T > * > &edgeSet) overrideCXXGRAPH::Graph_TS< T >virtual
STANDARD_CSV enum valueCXXGRAPH::Graph< T >
STANDARD_TSV enum valueCXXGRAPH::Graph< T >
writeToFile(typename Graph< T >::InputOutputFormat format=Graph< T >::InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) const overrideCXXGRAPH::Graph_TS< T >
CXXGRAPH::Graph::writeToFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) constCXXGRAPH::Graph< T >virtual
partitionGraph(PARTITIONING::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const overrideCXXGRAPH::Graph_TS< T >virtual
readFromFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool readNodeFeat=false, bool readEdgeWeight=false) overrideCXXGRAPH::Graph_TS< T >virtual
releaseLock() const (defined in CXXGRAPH::ThreadSafe)CXXGRAPH::ThreadSafeinline
removeEdge(unsigned long edgeId) overrideCXXGRAPH::Graph_TS< T >virtual
setEdgeSet(std::list< const Edge< T > * > &edgeSet) overrideCXXGRAPH::Graph_TS< T >virtual
writeToFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) const overrideCXXGRAPH::Graph_TS< T >virtual
~Graph()=default (defined in CXXGRAPH::Graph< T >)CXXGRAPH::Graph< T >
~Graph_TS()=default (defined in CXXGRAPH::Graph_TS< T >)CXXGRAPH::Graph_TS< T >
diff --git a/docs/html/d2/de9/ThreadSafe_8hpp_source.html b/docs/html/d2/de9/ThreadSafe_8hpp_source.html new file mode 100644 index 000000000..c93c95042 --- /dev/null +++ b/docs/html/d2/de9/ThreadSafe_8hpp_source.html @@ -0,0 +1,132 @@ + + + + + + + +CXXGraph: /github/workspace/include/Utility/ThreadSafe.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
ThreadSafe.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __THREADSAFE_H__
+
21 #define __THREADSAFE_H__
+
22 
+
23 #pragma once
+
24 
+
25 #include <mutex>
+
26 
+
27 namespace CXXGRAPH
+
28 {
+
29  class ThreadSafe
+
30  {
+
31  public:
+
32  void getLock() const;
+
33  void releaseLock() const;
+
34 
+
35  protected:
+
36  mutable std::mutex mutex;
+
37  };
+
38  //inline because the implementation of non-template function in header file
+
39  inline void ThreadSafe::getLock() const
+
40  {
+
41  mutex.lock();
+
42  }
+
43  //inline because the implementation of non-template function in header file
+
44  inline void ThreadSafe::releaseLock() const
+
45  {
+
46  mutex.unlock();
+
47  }
+
48 }
+
49 
+
50 #endif // __THREADSAFE_H__
+
Definition: ThreadSafe.hpp:30
+
+ + + + diff --git a/docs/html/d2/df2/HDRF_8hpp_source.html b/docs/html/d2/df2/HDRF_8hpp_source.html new file mode 100644 index 000000000..fd5a20481 --- /dev/null +++ b/docs/html/d2/df2/HDRF_8hpp_source.html @@ -0,0 +1,291 @@ + + + + + + + +CXXGraph: /github/workspace/include/Partitioning/HDRF.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
HDRF.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __CXXGRAPH_PARTITIONING_HDRF_H__
+
21 #define __CXXGRAPH_PARTITIONING_HDRF_H__
+
22 
+
23 #pragma once
+
24 
+
25 #include "Partitioning/Utility/Globals.hpp"
+
26 #include "Edge/Edge.hpp"
+
27 #include "PartitionStrategy.hpp"
+
28 
+
29 namespace CXXGRAPH
+
30 {
+
31  namespace PARTITIONING
+
32  {
+
33  template <typename T>
+
34  class HDRF : public PartitionStrategy<T>
+
35  {
+
36  private:
+
37  Globals GLOBALS;
+
38 
+
39  public:
+
40  HDRF(Globals G);
+
41  ~HDRF();
+
42 
+
43  void performStep(Edge<T> &e, PartitionState<T> &Sstate);
+
44  };
+
45  template <typename T>
+ +
47  {
+
48  this->GLOBALS = G;
+
49  }
+
50  template <typename T>
+
51  HDRF<T>::~HDRF()
+
52  {
+
53  }
+
54  template <typename T>
+
55  void HDRF<T>::performStep(Edge<T> &e, PartitionState<T> &state)
+
56  {
+
57 
+
58  int P = GLOBALS.numberOfPartition;
+
59  int epsilon = 1;
+
60  int u = e.getU();
+
61  int v = e.getV();
+
62 
+
63  Record u_record = state.getRecord(u);
+
64  Record v_record = state.getRecord(v);
+
65 
+
66  //*** ASK FOR LOCK
+
67  int sleep_time = 2;
+
68  while (!u_record.getLock())
+
69  {
+
70  sleep(sleep_time);
+
71  sleep = (int)pow(sleep_time, 2);
+
72  }
+
73  sleep_time = 2;
+
74  while (!v_record.getLock())
+
75  {
+
76  sleep(sleep_time);
+
77  sleep = (int)pow(sleep_time, 2);
+
78  if (sleep_time > GLOBALS.SLEEP_LIMIT)
+
79  {
+
80  u_record.releaseLock();
+
81  performStep(e, state);
+
82  return;
+
83  } //TO AVOID DEADLOCK
+
84  }
+
85  //*** LOCK TAKEN
+
86 
+
87  int machine_id = -1;
+
88 
+
89  //*** COMPUTE MAX AND MIN LOAD
+
90  int MIN_LOAD = state.getMinLoad();
+
91  int MAX_LOAD = state.getMaxLoad();
+
92 
+
93  //*** COMPUTE SCORES, FIND MIN SCORE, AND COMPUTE CANDIDATES PARITIONS
+
94  std::list<int> candidates;
+
95  double MAX_SCORE = 0.0;
+
96 
+
97  for (int m = 0; m < P; m++)
+
98  {
+
99 
+
100  int degree_u = u_record.getDegree() + 1;
+
101  int degree_v = v_record.getDegree() + 1;
+
102  int SUM = degree_u + degree_v;
+
103  double fu = 0;
+
104  double fv = 0;
+
105  if (u_record.hasReplicaInPartition(m))
+
106  {
+
107  fu = degree_u;
+
108  fu /= SUM;
+
109  fu = 1 + (1 - fu);
+
110  }
+
111  if (v_record.hasReplicaInPartition(m))
+
112  {
+
113  fv = degree_v;
+
114  fv /= SUM;
+
115  fv = 1 + (1 - fv);
+
116  }
+
117  int load = state.getMachineLoad(m);
+
118  double bal = (MAX_LOAD - load);
+
119  bal /= (epsilon + MAX_LOAD - MIN_LOAD);
+
120  if (bal < 0)
+
121  {
+
122  bal = 0;
+
123  }
+
124  double SCORE_m = fu + fv + GLOBALS.lambda * bal;
+
125  if (SCORE_m < 0)
+
126  {
+
127  std::cout << "ERRORE: SCORE_m<0" << std::endl;
+
128  std::cout << "fu: " << fu << std::endl;
+
129  std::cout << "fv: " << fv << std::endl;
+
130  std::cout << "GLOBALS.LAMBDA: " << GLOBALS.lambda << std::endl;
+
131  std::cout << "bal: " << bal << std::endl;
+
132  exit(-1);
+
133  }
+
134  if (SCORE_m > MAX_SCORE)
+
135  {
+
136  MAX_SCORE = SCORE_m;
+
137  candidates.clear();
+
138  candidates.push_back(m);
+
139  }
+
140  else if (SCORE_m == MAX_SCORE)
+
141  {
+
142  candidates.push_back(m);
+
143  }
+
144  }
+
145 
+
146  //*** CHECK TO AVOID ERRORS
+
147  if (candidates.empty())
+
148  {
+
149  std::cout << "ERROR: GreedyObjectiveFunction.performStep -> candidates.isEmpty()" << std::endl;
+
150  std::cout << "MAX_SCORE: " << MAX_SCORE << std::endl;
+
151  exit(-1);
+
152  }
+
153 
+
154  //*** PICK A RANDOM ELEMENT FROM CANDIDATES
+
155  /* initialize random seed: */
+
156  srand(time(NULL));
+
157 
+
158  int choice = rand() % candidates.size();
+
159  // TODOOOOOOOOO
+
160  //machine_id = candidates.at(choice);
+
161 
+
162  try
+
163  {
+
164  CoordinatedPartitionState<T> &cord_state = dynamic_cast<CoordinatedPartitionState<T> &>(state);
+
165  //NEW UPDATE RECORDS RULE TO UPFDATE THE SIZE OF THE PARTITIONS EXPRESSED AS THE NUMBER OF VERTICES THEY CONTAINS
+
166  if (!u_record.hasReplicaInPartition(machine_id))
+
167  {
+
168  u_record.addPartition(machine_id);
+
169  cord_state.incrementMachineLoadVertices(machine_id);
+
170  }
+
171  if (!v_record.hasReplicaInPartition(machine_id))
+
172  {
+
173  v_record.addPartition(machine_id);
+
174  cord_state.incrementMachineLoadVertices(machine_id);
+
175  }
+
176  }
+
177  catch (std::bad_cast)
+
178  {
+
179  // use employee's member functions
+
180  //1-UPDATE RECORDS
+
181  if (!u_record.hasReplicaInPartition(machine_id))
+
182  {
+
183  u_record.addPartition(machine_id);
+
184  }
+
185  if (!v_record.hasReplicaInPartition(machine_id))
+
186  {
+
187  v_record.addPartition(machine_id);
+
188  }
+
189  }
+
190 
+
191  //2-UPDATE EDGES
+
192  state.incrementMachineLoad(machine_id, e);
+
193 
+
194  //3-UPDATE DEGREES
+
195  u_record.incrementDegree();
+
196  v_record.incrementDegree();
+
197 
+
198  //*** RELEASE LOCK
+
199  u_record.releaseLock();
+
200  v_record.releaseLock();
+
201  }
+
202  }
+
203 }
+
204 
+
205 #endif // __CXXGRAPH_PARTITIONING_HDRF_H__
+
Definition: Edge.hpp:40
+
Definition: Globals.hpp:32
+
Definition: HDRF.hpp:35
+
Definition: PartitionState.hpp:31
+
Definition: PartitionStrategy.hpp:34
+
+ + + + diff --git a/docs/html/d3/d4d/Typedef_8hpp_source.html b/docs/html/d3/d4d/Typedef_8hpp_source.html new file mode 100644 index 000000000..cc3ca74f3 --- /dev/null +++ b/docs/html/d3/d4d/Typedef_8hpp_source.html @@ -0,0 +1,170 @@ + + + + + + + +CXXGraph: /github/workspace/include/Utility/Typedef.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
Typedef.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __CXXGRAPH_TYPEDEF_H__
+
21 #define __CXXGRAPH_TYPEDEF_H__
+
22 
+
23 #pragma once
+
24 
+
25 #include <map>
+
26 #include <string>
+
27 #include <fstream>
+
28 
+
29 namespace CXXGRAPH
+
30 {
+
31 
+
32  template <typename T>
+
33  class Node;
+
34 
+
35  template <typename T>
+
36  class Edge;
+
37 
+
38  namespace PARTITIONING{
+
39  template<typename T>
+
40  class Partition;
+
41  }
+
42  // ENUMERATION //////////////////////////////////////
+
43 
+
45  enum E_InputOutputFormat
+
46  {
+
47  STANDARD_CSV,
+
48  STANDARD_TSV,
+
49  OUT_1,
+
50  OUT_2
+
51  };
+
52 
+
53  typedef E_InputOutputFormat InputOutputFormat;
+
54 
+
55 
+
56 
+
58  // Structures ///////////////////////////////////////
+
59 
+ +
62  {
+
63  bool success; // TRUE if the function does not return error, FALSE otherwise
+
64  std::string errorMessage; //message of error
+
65  double result; //result (valid only if success is TRUE)
+
66  };
+ +
68 
+ +
71  {
+
72  bool success; // TRUE if the function does not return error, FALSE otherwise
+
73  std::string errorMessage; //message of error
+
74  std::map<unsigned long, long> minDistanceMap; //result a map that contains the node id and the minumum distance from source (valid only if success is TRUE)
+
75  };
+ +
77 
+
79 
+
80 
+
82  // Using Definition ///////////////////////////////////////////////////////////////
+
83 
+
84  template <typename T>
+
85  using AdjacencyMatrix = std::map<const Node<T> *, std::vector<std::pair<const Node<T> *, const Edge<T> *>>>;
+
86 
+
87  template <typename T>
+
88  using PartitionMap = std::map<unsigned int, PARTITIONING::Partition<T> *>;
+
89 
+
91 }
+
92 
+
93 #endif // __CXXGRAPH_TYPEDEF_H__
+
Definition: Edge.hpp:40
+
Struct that contains the information about Dijsktra's Algorithm results.
Definition: Typedef.hpp:71
+
Struct that contains the information about Dijsktra's Algorithm results.
Definition: Typedef.hpp:62
+
+ + + + diff --git a/docs/html/d3/d6b/Record_8hpp_source.html b/docs/html/d3/d6b/Record_8hpp_source.html new file mode 100644 index 000000000..b00f84cb0 --- /dev/null +++ b/docs/html/d3/d6b/Record_8hpp_source.html @@ -0,0 +1,125 @@ + + + + + + + +CXXGraph: /github/workspace/include/Partitioning/Record.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
Record.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __CXXGRAPH_PARTITIONING_RECORD_H__
+
21 #define __CXXGRAPH_PARTITIONING_RECORD_H__
+
22 
+
23 #pragma once
+
24 
+
25 namespace CXXGRAPH {
+
26  namespace PARTITIONING {
+
27  template <typename T>
+
28  class Record
+
29  {
+
30  public:
+
31  virtual PartitionMap<T> &getPartitions() = 0;
+
32  virtual void addPartition(int m) = 0;
+
33  virtual bool hasReplicaInPartition(int m) = 0;
+
34  virtual bool getLock() = 0;
+
35  virtual bool releaseLock() = 0;
+
36  virtual int getReplicas() = 0;
+
37  virtual int getDegree() = 0;
+
38  virtual void incrementDegree() = 0;
+
39  };
+
40  }
+
41 }
+
42 
+
43 #endif // __CXXGRAPH_PARTITIONING_RECORD_H__
+
Definition: Record.hpp:29
+
+ + + + diff --git a/docs/html/d3/d91/Graph__TS_8hpp_source.html b/docs/html/d3/d91/Graph__TS_8hpp_source.html new file mode 100644 index 000000000..7a61c9e21 --- /dev/null +++ b/docs/html/d3/d91/Graph__TS_8hpp_source.html @@ -0,0 +1,340 @@ + + + + + + + +CXXGraph: /github/workspace/include/Graph/Graph_TS.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
Graph_TS.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __GRAPH_TS_H__
+
21 #define __GRAPH_TS_H__
+
22 
+
23 #pragma once
+
24 
+
25 #include "Graph/Graph.hpp"
+
26 
+
27 namespace CXXGRAPH
+
28 {
+
29 
+
31  template <typename T>
+
32  class Graph_TS : public Graph<T>, public ThreadSafe
+
33  {
+
34  public:
+
35  Graph_TS() = default;
+
36  Graph_TS(const std::list<const Edge<T> *> &edgeSet);
+
37  Graph_TS(const Graph<T> &graph);
+
38  ~Graph_TS() = default;
+
47  const std::list<const Edge<T> *> &getEdgeSet() const override;
+
56  void setEdgeSet(std::list<const Edge<T> *> &edgeSet) override;
+
65  void addEdge(const Edge<T> *edge) override;
+
74  void removeEdge(unsigned long edgeId) override;
+
83  const std::list<const Node<T> *> getNodeSet() const override;
+
93  const std::optional<const Edge<T> *> getEdge(unsigned long edgeId) const override;
+
99  const AdjacencyMatrix<T> getAdjMatrix() const override;
+
112  const DijkstraResult dijkstra(const Node<T> &source, const Node<T> &target) const override;
+
123  const std::vector<Node<T>> breadth_first_search(const Node<T> &start) const override;
+
134  const std::vector<Node<T>> depth_first_search(const Node<T> &start) const override;
+
135 
+
144  bool isCyclicDirectedGraphDFS() const override;
+
145 
+
154  bool isCyclicDirectedGraphBFS() const override;
+
155 
+
163  bool isDirectedGraph() const override;
+
164 
+
191  const DialResult dial(const Node<T> &source, int maxWeight) const override;
+
192 
+
206  int writeToFile(InputOutputFormat format = InputOutputFormat::STANDARD_CSV, const std::string &workingDir = ".", const std::string &OFileName = "graph", bool compress = false, bool writeNodeFeat = false, bool writeEdgeWeight = false) const override;
+
207 
+
221  int readFromFile(InputOutputFormat format = InputOutputFormat::STANDARD_CSV, const std::string &workingDir = ".", const std::string &OFileName = "graph", bool compress = false, bool readNodeFeat = false, bool readEdgeWeight = false) override;
+
222 
+
232  PartitionMap<T> partitionGraph(PARTITIONING::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const override;
+
233  };
+
234 
+
235  template <typename T>
+
236  Graph_TS<T>::Graph_TS(const std::list<const Edge<T> *> &edgeSet) : Graph<T>(edgeSet), ThreadSafe() {}
+
237 
+
238  template <typename T>
+
239  Graph_TS<T>::Graph_TS(const Graph<T> &graph) : Graph<T>(graph), ThreadSafe() {}
+
240 
+
241  template <typename T>
+
242  const std::list<const Edge<T> *> &Graph_TS<T>::getEdgeSet() const
+
243  {
+
244  std::lock_guard<std::mutex> lock(mutex);
+
245  return Graph<T>::getEdgeSet();
+
246  }
+
247 
+
248  template <typename T>
+
249  void Graph_TS<T>::setEdgeSet(std::list<const Edge<T> *> &edgeSet)
+
250  {
+
251  getLock();
+
252  Graph<T>::setEdgeSet(edgeSet);
+
253  releaseLock();
+
254  }
+
255 
+
256  template <typename T>
+
257  void Graph_TS<T>::addEdge(const Edge<T> *edge)
+
258  {
+
259  getLock();
+
260  Graph<T>::addEdge(edge);
+
261  releaseLock();
+
262  }
+
263 
+
264  template <typename T>
+
265  void Graph_TS<T>::removeEdge(unsigned long edgeId)
+
266  {
+
267  getLock();
+
268  Graph<T>::removeEdge(edgeId);
+
269  releaseLock();
+
270  }
+
271 
+
272  template <typename T>
+
273  const std::list<const Node<T> *> Graph_TS<T>::getNodeSet() const
+
274  {
+
275  getLock();
+
276  auto ns = Graph<T>::getNodeSet();
+
277  releaseLock();
+
278  return ns;
+
279  }
+
280 
+
281  template <typename T>
+
282  const std::optional<const Edge<T> *> Graph_TS<T>::getEdge(unsigned long edgeId) const
+
283  {
+
284  getLock();
+
285  auto e = Graph<T>::getEdge(edgeId);
+
286  releaseLock();
+
287  return e;
+
288  }
+
289 
+
290  template <typename T>
+
291  const AdjacencyMatrix<T> Graph_TS<T>::getAdjMatrix() const
+
292  {
+
293  getLock();
+
294  auto adjm = Graph<T>::getAdjMatrix();
+
295  releaseLock();
+
296  return adjm;
+
297  }
+
298 
+
299  template <typename T>
+
300  const DijkstraResult Graph_TS<T>::dijkstra(const Node<T> &source, const Node<T> &target) const
+
301  {
+
302  getLock();
+
303  auto dij = Graph<T>::dijkstra(source, target);
+
304  releaseLock();
+
305  return dij;
+
306  }
+
307 
+
308  template <typename T>
+
309  const std::vector<Node<T>> Graph_TS<T>::breadth_first_search(const Node<T> &start) const
+
310  {
+
311  getLock();
+
312  auto bfs = Graph<T>::breadth_first_search(start);
+
313  releaseLock();
+
314  return bfs;
+
315  }
+
316 
+
317  template <typename T>
+
318  const std::vector<Node<T>> Graph_TS<T>::depth_first_search(const Node<T> &start) const
+
319  {
+
320  getLock();
+
321  auto dfs = Graph<T>::depth_first_search(start);
+
322  releaseLock();
+
323  return dfs;
+
324  }
+
325 
+
326  template <typename T>
+ +
328  {
+
329  getLock();
+
330  auto result = Graph<T>::isCyclicDirectedGraphDFS();
+
331  releaseLock();
+
332  return result;
+
333  }
+
334 
+
335  template <typename T>
+ +
337  {
+
338  getLock();
+
339  auto result = Graph<T>::isCyclicDirectedGraphBFS();
+
340  releaseLock();
+
341  return result;
+
342  }
+
343 
+
344  template <typename T>
+ +
346  {
+
347  getLock();
+
348  auto result = Graph<T>::isDirectedGraph();
+
349  releaseLock();
+
350  return result;
+
351  }
+
352 
+
353  template <typename T>
+
354  const DialResult Graph_TS<T>::dial(const Node<T> &source, int maxWeight) const
+
355  {
+
356  getLock();
+
357  auto dial = Graph<T>::dial(source, maxWeight);
+
358  releaseLock();
+
359  return dial;
+
360  }
+
361 
+
362  template <typename T>
+
363  int Graph_TS<T>::writeToFile(InputOutputFormat format, const std::string &workingDir, const std::string &OFileName, bool compress, bool writeNodeFeat, bool writeEdgeWeight) const
+
364  {
+
365  getLock();
+
366  auto result = Graph<T>::writeToFile(format, workingDir, OFileName, compress, writeNodeFeat, writeEdgeWeight);
+
367  releaseLock();
+
368  return result;
+
369  }
+
370 
+
371  template <typename T>
+
372  int Graph_TS<T>::readFromFile(InputOutputFormat format, const std::string &workingDir, const std::string &OFileName, bool compress, bool readNodeFeat, bool readEdgeWeight)
+
373  {
+
374  getLock();
+
375  auto result = Graph<T>::readFromFile(format, workingDir, OFileName, compress, readNodeFeat, readEdgeWeight);
+
376  releaseLock();
+
377  return result;
+
378  }
+
379 
+
380  template <typename T>
+
381  PartitionMap<T> Graph_TS<T>::partitionGraph(PARTITIONING::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const
+
382  {
+
383  getLock();
+
384  auto partitions = Graph<T>::partitionGraph(algorithm, numberOfPartitions);
+
385  releaseLock();
+
386  return partitions;
+
387  }
+
388 }
+
389 #endif // __GRAPH_TS_H__
+
Definition: Edge.hpp:40
+
Class that implement the Thread Safe Graph.
Definition: Graph_TS.hpp:33
+
const std::optional< const Edge< T > * > getEdge(unsigned long edgeId) const override
Function that return an Edge with specific ID if Exist in the Graph Note: Thread Safe.
Definition: Graph_TS.hpp:282
+
const std::list< const Node< T > * > getNodeSet() const override
Function that return the Node Set of the Graph Note: Thread Safe.
Definition: Graph_TS.hpp:273
+
void setEdgeSet(std::list< const Edge< T > * > &edgeSet) override
Function set the Edge Set of the Graph Note: Thread Safe.
Definition: Graph_TS.hpp:249
+
bool isDirectedGraph() const override
This function checks if a graph is directed Note: Thread Safe.
Definition: Graph_TS.hpp:345
+
const DijkstraResult dijkstra(const Node< T > &source, const Node< T > &target) const override
Function runs the dijkstra algorithm for some source node and target node in the graph and returns th...
Definition: Graph_TS.hpp:300
+
int writeToFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) const override
This function write the graph in an output file Note: Thread Safe.
Definition: Graph_TS.hpp:363
+
void addEdge(const Edge< T > *edge) override
Function add an Edge to the Graph Edge Set Note: Thread Safe.
Definition: Graph_TS.hpp:257
+
PartitionMap< T > partitionGraph(PARTITIONING::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const override
This function partition a graph in a set of partitions Note: Thread Safe.
Definition: Graph_TS.hpp:381
+
bool isCyclicDirectedGraphBFS() const override
This function uses BFS to check for cycle in the graph. Pay Attention, this function work only with d...
Definition: Graph_TS.hpp:336
+
int readFromFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool readNodeFeat=false, bool readEdgeWeight=false) override
This function read the graph from an input file Note: Thread Safe.
Definition: Graph_TS.hpp:372
+
const std::vector< Node< T > > breadth_first_search(const Node< T > &start) const override
Function performs the breadth first search algorithm over the graph Note: Thread Safe.
Definition: Graph_TS.hpp:309
+
void removeEdge(unsigned long edgeId) override
Function remove an Edge from the Graph Edge Set Note: Thread Safe.
Definition: Graph_TS.hpp:265
+
const std::list< const Edge< T > * > & getEdgeSet() const override
Function that return the Edge set of the Graph Note: Thread Safe.
Definition: Graph_TS.hpp:242
+
const std::vector< Node< T > > depth_first_search(const Node< T > &start) const override
Function performs the depth first search algorithm over the graph Note: Thread Safe.
Definition: Graph_TS.hpp:318
+
const DialResult dial(const Node< T > &source, int maxWeight) const override
This function write the graph in an output file Note: Thread Safe.
Definition: Graph_TS.hpp:354
+
bool isCyclicDirectedGraphDFS() const override
This function uses DFS to check for cycle in the graph. Pay Attention, this function work only with d...
Definition: Graph_TS.hpp:327
+
const AdjacencyMatrix< T > getAdjMatrix() const override
This function generate a list of adjacency matrix with every element of the matrix contain the node w...
Definition: Graph_TS.hpp:291
+
Class that implement the Graph. ( This class is not Thread Safe )
Definition: Graph.hpp:76
+
virtual const std::vector< Node< T > > depth_first_search(const Node< T > &start) const
Function performs the depth first search algorithm over the graph Note: No Thread Safe.
Definition: Graph.hpp:1013
+
virtual const std::list< const Edge< T > * > & getEdgeSet() const
Function that return the Edge set of the Graph Note: No Thread Safe.
Definition: Graph.hpp:307
+
virtual const std::optional< const Edge< T > * > getEdge(unsigned long edgeId) const
Function that return an Edge with specific ID if Exist in the Graph Note: No Thread Safe.
Definition: Graph.hpp:368
+
virtual bool isCyclicDirectedGraphBFS() const
This function uses BFS to check for cycle in the graph. Pay Attention, this function work only with d...
Definition: Graph.hpp:1135
+
virtual void removeEdge(unsigned long edgeId)
Function remove an Edge from the Graph Edge Set Note: No Thread Safe.
Definition: Graph.hpp:337
+
virtual int writeToFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) const
This function write the graph in an output file Note: No Thread Safe.
Definition: Graph.hpp:1348
+
virtual bool isDirectedGraph() const
This function checks if a graph is directed Note: No Thread Safe.
Definition: Graph.hpp:1204
+
virtual const DialResult dial(const Node< T > &source, int maxWeight) const
This function write the graph in an output file Note: No Thread Safe.
Definition: Graph.hpp:1220
+
virtual const DijkstraResult dijkstra(const Node< T > &source, const Node< T > &target) const
Function runs the dijkstra algorithm for some source node and target node in the graph and returns th...
Definition: Graph.hpp:863
+
virtual bool isCyclicDirectedGraphDFS() const
This function uses DFS to check for cycle in the graph. Pay Attention, this function work only with d...
Definition: Graph.hpp:1045
+
virtual void addEdge(const Edge< T > *edge)
Function add an Edge to the Graph Edge Set Note: No Thread Safe.
Definition: Graph.hpp:327
+
virtual PartitionMap< T > partitionGraph(PARTITIONING::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const
This function partition a graph in a set of partitions Note: No Thread Safe.
Definition: Graph.hpp:1485
+
virtual int readFromFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool readNodeFeat=false, bool readEdgeWeight=false)
This function read the graph from an input file Note: No Thread Safe.
Definition: Graph.hpp:1421
+
virtual const AdjacencyMatrix< T > getAdjMatrix() const
This function generate a list of adjacency matrix with every element of the matrix contain the node w...
Definition: Graph.hpp:836
+
virtual const std::list< const Node< T > * > getNodeSet() const
Function that return the Node Set of the Graph Note: No Thread Safe.
Definition: Graph.hpp:348
+
virtual const std::vector< Node< T > > breadth_first_search(const Node< T > &start) const
Function performs the breadth first search algorithm over the graph Note: No Thread Safe.
Definition: Graph.hpp:973
+
virtual void setEdgeSet(std::list< const Edge< T > * > &edgeSet)
Function set the Edge Set of the Graph Note: No Thread Safe.
Definition: Graph.hpp:313
+
Definition: Node.hpp:35
+
Definition: ThreadSafe.hpp:30
+
Struct that contains the information about Dijsktra's Algorithm results.
Definition: Typedef.hpp:71
+
Struct that contains the information about Dijsktra's Algorithm results.
Definition: Typedef.hpp:62
+
+ + + + diff --git a/docs/html/d3/dd2/classCXXGRAPH_1_1Node.html b/docs/html/d3/dd2/classCXXGRAPH_1_1Node.html index f4b468c86..962916276 100644 --- a/docs/html/d3/dd2/classCXXGRAPH_1_1Node.html +++ b/docs/html/d3/dd2/classCXXGRAPH_1_1Node.html @@ -102,7 +102,7 @@  
The documentation for this class was generated from the following file: diff --git a/docs/html/d3/de1/classCXXGRAPH_1_1PARTITIONING_1_1Record.html b/docs/html/d3/de1/classCXXGRAPH_1_1PARTITIONING_1_1Record.html new file mode 100644 index 000000000..5ef8d9d3d --- /dev/null +++ b/docs/html/d3/de1/classCXXGRAPH_1_1PARTITIONING_1_1Record.html @@ -0,0 +1,124 @@ + + + + + + + +CXXGraph: CXXGRAPH::PARTITIONING::Record< T > Class Template Reference + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
CXXGRAPH::PARTITIONING::Record< T > Class Template Referenceabstract
+
+
+
+Inheritance diagram for CXXGRAPH::PARTITIONING::Record< T >:
+
+
Inheritance graph
+ + + + +
[legend]
+ + + + + + + + + + + + + + + + + + +

+Public Member Functions

+virtual PartitionMap< T > & getPartitions ()=0
 
+virtual void addPartition (int m)=0
 
+virtual bool hasReplicaInPartition (int m)=0
 
+virtual bool getLock ()=0
 
+virtual bool releaseLock ()=0
 
+virtual int getReplicas ()=0
 
+virtual int getDegree ()=0
 
+virtual void incrementDegree ()=0
 
+
The documentation for this class was generated from the following file:
    +
  • /github/workspace/include/Partitioning/Record.hpp
  • +
+
+ + + + diff --git a/docs/html/d4/d1e/ConstValue_8hpp_source.html b/docs/html/d4/d1e/ConstValue_8hpp_source.html new file mode 100644 index 000000000..6fa85eeff --- /dev/null +++ b/docs/html/d4/d1e/ConstValue_8hpp_source.html @@ -0,0 +1,113 @@ + + + + + + + +CXXGraph: /github/workspace/include/Utility/ConstValue.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
ConstValue.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __CONSTVALUE_H__
+
21 #define __CONSTVALUE_H__
+
22 
+
23 #pragma once
+
24 
+
25 #include <limits>
+
26 
+
27 namespace CXXGRAPH
+
28 {
+
29  constexpr double INF_DOUBLE = std::numeric_limits<double>::max();
+
30 }
+
31 
+
32 #endif // __CONSTVALUE_H__
+
+ + + + diff --git a/docs/html/d5/d2e/classCXXGRAPH_1_1Runnable.html b/docs/html/d5/d2e/classCXXGRAPH_1_1Runnable.html new file mode 100644 index 000000000..dc5730a0a --- /dev/null +++ b/docs/html/d5/d2e/classCXXGRAPH_1_1Runnable.html @@ -0,0 +1,94 @@ + + + + + + + +CXXGraph: CXXGRAPH::Runnable Class Reference + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
CXXGRAPH::Runnable Class Referenceabstract
+
+
+ + + + +

+Public Member Functions

+virtual void run ()=0
 
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/docs/html/d5/d36/PartitionAlgorithm_8hpp_source.html b/docs/html/d5/d36/PartitionAlgorithm_8hpp_source.html new file mode 100644 index 000000000..e9f8684d3 --- /dev/null +++ b/docs/html/d5/d36/PartitionAlgorithm_8hpp_source.html @@ -0,0 +1,120 @@ + + + + + + + +CXXGraph: /github/workspace/include/Partitioning/PartitionAlgorithm.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
PartitionAlgorithm.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __CXXGRAPH_PARTITIONING_PARTITIONALGORITHM_H__
+
21 #define __CXXGRAPH_PARTITIONING_PARTITIONALGORITHM_H__
+
22 
+
23 #pragma once
+
24 
+
25 namespace CXXGRAPH
+
26 {
+
27  namespace PARTITIONING
+
28  {
+
30  enum E_PartitionAlgorithm
+
31  {
+
32  GREEDY_VC_ALG,
+
33  HDRF_ALG,
+
34  ALG_2
+
35  };
+
36  typedef E_PartitionAlgorithm PartitionAlgorithm;
+
37  }
+
38 }
+
39 
+
40 #endif // __CXXGRAPH_PARTITIONING_PARTITIONALGORITHM_H__
+
+ + + + diff --git a/docs/html/d5/d64/Globals_8hpp_source.html b/docs/html/d5/d64/Globals_8hpp_source.html new file mode 100644 index 000000000..982003248 --- /dev/null +++ b/docs/html/d5/d64/Globals_8hpp_source.html @@ -0,0 +1,147 @@ + + + + + + + +CXXGraph: /github/workspace/include/Partitioning/Utility/Globals.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
Globals.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __CXXGRAPH_PARTITIONING_GLOBALS_H__
+
21 #define __CXXGRAPH_PARTITIONING_GLOBALS_H__
+
22 
+
23 #pragma once
+
24 
+
25 #include <thread>
+
26 #include "Partitioning/PartitionAlgorithm.hpp"
+
27 
+
28 
+
29 namespace CXXGRAPH {
+
30  namespace PARTITIONING {
+
31  class Globals
+
32  {
+
33  private:
+
34  public:
+
35  Globals(int numberOfPartiton, double lambda = 1, PartitionAlgorithm algorithm = PartitionAlgorithm::HDRF_ALG, unsigned int threads = std::thread::hardware_concurrency());
+
36  ~Globals();
+
37 
+
38  void print();
+
39 
+
40  //CONSTANT
+
41  const int SLEEP_LIMIT = 1024;
+
42  const int PLACES = 4;
+
43 
+
44  int numberOfPartition; //number of partitions
+
45  //OPTIONAL
+
46  PartitionAlgorithm partitionStategy;
+
47  double lambda;
+
48  unsigned int threads;
+
49  };
+
50 
+
51  inline Globals::Globals(int numberOfPartiton, double lambda, PartitionAlgorithm algorithm, unsigned int threads)
+
52  {
+
53  this->numberOfPartition = numberOfPartiton;
+
54  this->partitionStategy = algorithm;
+
55  this->lambda = lambda;
+
56  this->threads = threads;
+
57  }
+
58 
+
59  inline Globals::~Globals()
+
60  {
+
61  }
+
62  }
+
63 }
+
64 
+
65 #endif // __CXXGRAPH_PARTITIONING_GLOBALS_H__
+
Definition: Globals.hpp:32
+
+ + + + diff --git a/docs/html/d5/d80/CXXGraph_8hpp_source.html b/docs/html/d5/d80/CXXGraph_8hpp_source.html new file mode 100644 index 000000000..938b069c9 --- /dev/null +++ b/docs/html/d5/d80/CXXGraph_8hpp_source.html @@ -0,0 +1,107 @@ + + + + + + + +CXXGraph: /github/workspace/include/CXXGraph.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
CXXGraph.hpp
+
+
+
1 #ifndef __CXXGRAPH_H__
+
2 #define __CXXGRAPH_H__
+
3 
+
4 #include "CXXGraphConfig.h"
+
5 #include "Edge/Edge.hpp"
+
6 #include "Edge/DirectedEdge.hpp"
+
7 #include "Edge/DirectedWeightedEdge.hpp"
+
8 #include "Edge/UndirectedEdge.hpp"
+
9 #include "Edge/UndirectedWeightedEdge.hpp"
+
10 #include "Edge/Weighted.hpp"
+
11 #include "Graph/Graph.hpp"
+
12 #include "Graph/Graph_TS.hpp"
+
13 #include "Node/Node.hpp"
+
14 #include "Partitioning/Partition.hpp"
+
15 #include "Partitioning/CoordinatedPartitionState.hpp"
+
16 #include "Partitioning/CoordinatedRecord.hpp"
+
17 #include "Partitioning/HDRF.hpp"
+
18 #include "Partitioning/PartitionAlgorithm.hpp"
+
19 #include "Partitioning/Partitioner.hpp"
+
20 #include "Partitioning/PartitionerThread.hpp"
+
21 #include "Partitioning/PartitioningStats.hpp"
+
22 #include "Partitioning/PartitionState.hpp"
+
23 #include "Partitioning/PartitionStrategy.hpp"
+
24 #include "Partitioning/Record.hpp"
+
25 
+
26 #endif // __CXXGRAPH_H__
+
+ + + + diff --git a/docs/html/d5/d93/structCXXGRAPH_1_1DialResult__struct.html b/docs/html/d5/d93/structCXXGRAPH_1_1DialResult__struct.html index 9e751f670..ddf86fa92 100644 --- a/docs/html/d5/d93/structCXXGRAPH_1_1DialResult__struct.html +++ b/docs/html/d5/d93/structCXXGRAPH_1_1DialResult__struct.html @@ -79,7 +79,7 @@

Struct that contains the information about Dijsktra's Algorithm results. More...

-

#include <Graph.hpp>

+

#include <Typedef.hpp>

@@ -96,7 +96,7 @@

Detailed Description

Struct that contains the information about Dijsktra's Algorithm results.


The documentation for this struct was generated from the following file: diff --git a/docs/html/d5/db2/UndirectedEdge_8hpp_source.html b/docs/html/d5/db2/UndirectedEdge_8hpp_source.html new file mode 100644 index 000000000..1414f0d28 --- /dev/null +++ b/docs/html/d5/db2/UndirectedEdge_8hpp_source.html @@ -0,0 +1,188 @@ + + + + + + + +CXXGraph: /github/workspace/include/Edge/UndirectedEdge.hpp Source File + + + + + + + + + +
+
+

Public Attributes

+ + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+ + + + + + + + + +
+
+ + +
+ +
+ + + +
+
+
UndirectedEdge.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __UNDIRECTEDEDGE_H__
+
21 #define __UNDIRECTEDEDGE_H__
+
22 
+
23 #pragma once
+
24 
+
25 #include "Edge.hpp"
+
26 
+
27 namespace CXXGRAPH
+
28 {
+
29 
+
30  template <typename T>
+
31  class UndirectedEdge;
+
32 
+
33  // ostream operator
+
34  template <typename T>
+
35  std::ostream &operator<<(std::ostream &o, const UndirectedEdge<T> &edge);
+
36 
+
37  template <typename T>
+
38  class UndirectedEdge : public Edge<T>
+
39  {
+
40  public:
+
41  UndirectedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2);
+
42  UndirectedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair);
+
43  UndirectedEdge(const Edge<T> &edge);
+
44  virtual ~UndirectedEdge() = default;
+
45  const Node<T> &getNode1() const;
+
46  const Node<T> &getNode2() const;
+
47  const std::optional<bool> isDirected() const override;
+
48  const std::optional<bool> isWeighted() const override;
+
49  //operator
+
50  explicit operator DirectedEdge<T>() const { return DirectedEdge<T>(Edge<T>::getId(), Edge<T>::getNodePair()); }
+
51 
+
52  friend std::ostream &operator<<<>(std::ostream &os, const UndirectedEdge<T> &edge);
+
53  };
+
54 
+
55  template <typename T>
+
56  UndirectedEdge<T>::UndirectedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2) : Edge<T>(id, node1, node2)
+
57  {
+
58  }
+
59 
+
60  template <typename T>
+
61  UndirectedEdge<T>::UndirectedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair) : Edge<T>(id, nodepair)
+
62  {
+
63  }
+
64 
+
65  template <typename T>
+
66  UndirectedEdge<T>::UndirectedEdge(const Edge<T> &edge) : UndirectedEdge(edge.getId(), *(edge.getNodePair().first), *(edge.getNodePair().second))
+
67  {
+
68  }
+
69 
+
70  template <typename T>
+
71  const Node<T> &UndirectedEdge<T>::getNode1() const
+
72  {
+
73  return *(Edge<T>::getNodePair().first);
+
74  }
+
75 
+
76  template <typename T>
+
77  const Node<T> &UndirectedEdge<T>::getNode2() const
+
78  {
+
79  return *(Edge<T>::getNodePair().second);
+
80  }
+
81 
+
82  template <typename T>
+
83  const std::optional<bool> UndirectedEdge<T>::isDirected() const
+
84  {
+
85  return false;
+
86  }
+
87 
+
88  template <typename T>
+
89  const std::optional<bool> UndirectedEdge<T>::isWeighted() const
+
90  {
+
91  return false;
+
92  }
+
93 
+
94  template <typename T>
+
95  std::ostream &operator<<(std::ostream &os, const UndirectedEdge<T> &edge)
+
96  {
+
97  os << "((Node: " << edge.getNode1().getId() << ")) <----- |Edge: #" << edge.getId() << "|-----> ((Node: " << edge.getNode2().getId() << "))";
+
98  return os;
+
99  }
+
100 }
+
101 
+
102 
+
103 #endif // __UNDIRECTEDEDGE_H__
+
Definition: DirectedEdge.hpp:39
+
Definition: Edge.hpp:40
+
Definition: Node.hpp:35
+
Definition: UndirectedEdge.hpp:39
+
+ + + + diff --git a/docs/html/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.map b/docs/html/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.map new file mode 100644 index 000000000..3ea66c752 --- /dev/null +++ b/docs/html/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.map @@ -0,0 +1,4 @@ + + + + diff --git a/docs/html/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.md5 b/docs/html/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.md5 new file mode 100644 index 000000000..567e0cbbd --- /dev/null +++ b/docs/html/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.md5 @@ -0,0 +1 @@ +aa7e9bcf9adf5f0ec33e547fa0857a92 \ No newline at end of file diff --git a/docs/html/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.png b/docs/html/d6/d2c/classCXXGRAPH_1_1PARTITIONING_1_1Partition__coll__graph.png new file mode 100644 index 0000000000000000000000000000000000000000..87631278a151f53d4e47937428fdd738221c1a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Q-JR9?1Ay6JBq&&JDI;;dLox3->HY*da>K)L`Xu HWquC literal 0 HcmV?d00001 diff --git a/docs/html/d6/d85/DirectedEdge_8hpp_source.html b/docs/html/d6/d85/DirectedEdge_8hpp_source.html new file mode 100644 index 000000000..031a57063 --- /dev/null +++ b/docs/html/d6/d85/DirectedEdge_8hpp_source.html @@ -0,0 +1,189 @@ + + + + + + + +CXXGraph: /github/workspace/include/Edge/DirectedEdge.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
DirectedEdge.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __DIRECTEDEDGE_H__
+
21 #define __DIRECTEDEDGE_H__
+
22 
+
23 #pragma once
+
24 
+
25 #include "Edge.hpp"
+
26 
+
27 namespace CXXGRAPH
+
28 {
+
29  template <typename T>
+
30  class UndirectedEdge;
+
31 
+
32  template <typename T>
+
33  class DirectedEdge;
+
34  // ostream operator
+
35  template <typename T>
+
36  std::ostream &operator<<(std::ostream &o, const DirectedEdge<T> &edge);
+
37  template <typename T>
+
38  class DirectedEdge : public Edge<T>
+
39  {
+
40  public:
+
41  DirectedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2);
+
42  DirectedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair);
+
43  DirectedEdge(const Edge<T> &edge);
+
44  virtual ~DirectedEdge() = default;
+
45  const Node<T> &getFrom() const;
+
46  const Node<T> &getTo() const;
+
47  const std::optional<bool> isDirected() const override;
+
48  const std::optional<bool> isWeighted() const override;
+
49  //operator
+
50  explicit operator UndirectedEdge<T>() const { return UndirectedEdge<T>(Edge<T>::getId(), Edge<T>::getNodePair()); }
+
51 
+
52  friend std::ostream &operator<<<>(std::ostream &os, const DirectedEdge<T> &edge);
+
53  };
+
54 
+
55  template <typename T>
+
56  DirectedEdge<T>::DirectedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2) : Edge<T>(id, node1, node2)
+
57  {
+
58  }
+
59 
+
60  template <typename T>
+
61  DirectedEdge<T>::DirectedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair) : Edge<T>(id, nodepair)
+
62  {
+
63  }
+
64 
+
65  template <typename T>
+
66  DirectedEdge<T>::DirectedEdge(const Edge<T> &edge) : DirectedEdge(edge.getId(), *(edge.getNodePair().first), *(edge.getNodePair().second))
+
67  {
+
68  }
+
69 
+
70  template <typename T>
+
71  const Node<T> &DirectedEdge<T>::getFrom() const
+
72  {
+
73  return *(Edge<T>::getNodePair().first);
+
74  }
+
75 
+
76  template <typename T>
+
77  const Node<T> &DirectedEdge<T>::getTo() const
+
78  {
+
79  return *(Edge<T>::getNodePair().second);
+
80  }
+
81 
+
82  template <typename T>
+
83  const std::optional<bool> DirectedEdge<T>::isDirected() const
+
84  {
+
85  return true;
+
86  }
+
87 
+
88  template <typename T>
+
89  const std::optional<bool> DirectedEdge<T>::isWeighted() const
+
90  {
+
91  return false;
+
92  }
+
93 
+
94 
+
95 
+
96  template <typename T>
+
97  std::ostream &operator<<(std::ostream &os, const DirectedEdge<T> &edge)
+
98  {
+
99  os << "((Node: " << edge.getFrom().getId() << ")) +----- |Edge: #" << edge.getId() << "|-----> ((Node: " << edge.getTo().getId() << "))";
+
100  return os;
+
101  }
+
102 }
+
103 
+
104 #endif // __DIRECTEDEDGE_H__
+
Definition: DirectedEdge.hpp:39
+
Definition: Edge.hpp:40
+
Definition: Node.hpp:35
+
Definition: UndirectedEdge.hpp:39
+
+ + + + diff --git a/docs/html/d6/d85/PartitionStrategy_8hpp_source.html b/docs/html/d6/d85/PartitionStrategy_8hpp_source.html new file mode 100644 index 000000000..932d1df11 --- /dev/null +++ b/docs/html/d6/d85/PartitionStrategy_8hpp_source.html @@ -0,0 +1,125 @@ + + + + + + + +CXXGraph: /github/workspace/include/Partitioning/PartitionStrategy.hpp Source File + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+
+
PartitionStrategy.hpp
+
+
+
1 /***********************************************************/
+
2 /*** ______ ____ ______ _ ***/
+
3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
+
4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
+
5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
+
6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
+
7 /*** |_| ***/
+
8 /***********************************************************/
+
9 /*** Header-Only C++ Library for Graph ***/
+
10 /*** Representation and Algorithms ***/
+
11 /***********************************************************/
+
12 /*** Author: ZigRazor ***/
+
13 /*** E-Mail: zigrazor@gmail.com ***/
+
14 /***********************************************************/
+
15 /*** Collaboration: ----------- ***/
+
16 /***********************************************************/
+
17 /*** License: AGPL v3.0 ***/
+
18 /***********************************************************/
+
19 
+
20 #ifndef __CXXGRAPH_PARTITIONING_PARTITIONSTRATEGY_H__
+
21 #define __CXXGRAPH_PARTITIONING_PARTITIONSTRATEGY_H__
+
22 
+
23 #pragma once
+
24 
+
25 #include "Edge/Edge.hpp"
+
26 #include "PartitionState.hpp"
+
27 
+
28 namespace CXXGRAPH
+
29 {
+
30  namespace PARTITIONING
+
31  {
+
32  template <typename T>
+ +
34  {
+
35  public:
+
36  virtual void performStep(Edge<T> &t, PartitionState<T> &Sstate) = 0;
+
37  };
+
38  }
+
39 }
+
40 
+
41 #endif // __CXXGRAPH_PARTITIONING_PARTITIONSTRATEGY_H__
+
Definition: Edge.hpp:40
+
Definition: PartitionState.hpp:31
+
Definition: PartitionStrategy.hpp:34
+
+ + + + diff --git a/docs/html/d7/d1b/classCXXGRAPH_1_1PARTITIONING_1_1PartitionerThread.html b/docs/html/d7/d1b/classCXXGRAPH_1_1PARTITIONING_1_1PartitionerThread.html new file mode 100644 index 000000000..aaae2c15e --- /dev/null +++ b/docs/html/d7/d1b/classCXXGRAPH_1_1PARTITIONING_1_1PartitionerThread.html @@ -0,0 +1,104 @@ + + + + + + + +CXXGraph: CXXGRAPH::PARTITIONING::PartitionerThread< T > Class Template Reference + + + + + + + + + +
+
+ + + + + + + +
+
CXXGraph +  0.1.6 +
+
CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
CXXGRAPH::PARTITIONING::PartitionerThread< T > Class Template Reference
+
+
+ + + + + + +

+Public Member Functions

PartitionerThread (std::vector< Edge< T >> &list, PartitionState< T > *state, PartitionStrategy< T > &algorithm, std::list< int > *ids)
 
+void run ()
 
+ + + +

+Public Attributes

+std::list< int > * id_partitions
 
+
The documentation for this class was generated from the following file: +
+ + + + diff --git a/docs/html/d7/d24/classCXXGRAPH_1_1UndirectedWeightedEdge.html b/docs/html/d7/d24/classCXXGRAPH_1_1UndirectedWeightedEdge.html index 5df46171f..3a097a301 100644 --- a/docs/html/d7/d24/classCXXGRAPH_1_1UndirectedWeightedEdge.html +++ b/docs/html/d7/d24/classCXXGRAPH_1_1UndirectedWeightedEdge.html @@ -186,8 +186,9 @@ std::ostream & operator<< (std::ostream &os, const UndirectedWeightedEdge< T > &edge)   -
The documentation for this class was generated from the following file:
    -
  • /github/workspace/include/Graph.hpp
  • +
    The documentation for this class was generated from the following files: diff --git a/docs/html/d7/d2a/classCXXGRAPH_1_1Edge.html b/docs/html/d7/d2a/classCXXGRAPH_1_1Edge.html index 9b4b76082..83f873efa 100644 --- a/docs/html/d7/d2a/classCXXGRAPH_1_1Edge.html +++ b/docs/html/d7/d2a/classCXXGRAPH_1_1Edge.html @@ -123,7 +123,7 @@  
    The documentation for this class was generated from the following file: diff --git a/docs/html/d7/d41/classCXXGRAPH_1_1PARTITIONING_1_1Partition-members.html b/docs/html/d7/d41/classCXXGRAPH_1_1PARTITIONING_1_1Partition-members.html new file mode 100644 index 000000000..c894dcea0 --- /dev/null +++ b/docs/html/d7/d41/classCXXGRAPH_1_1PARTITIONING_1_1Partition-members.html @@ -0,0 +1,111 @@ + + + + + + + +CXXGraph: Member List + + + + + + + + + +
    +
    + + + + + + + +
    +
    CXXGraph +  0.1.6 +
    +
    CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
    +
    +
    + + + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    CXXGRAPH::PARTITIONING::Partition< T > Member List
    +
    +
    + +

    This is the complete list of members for CXXGRAPH::PARTITIONING::Partition< T >, including all inherited members.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    addEdge(const Edge< T > *edge)CXXGRAPH::Graph< T >virtual
    breadth_first_search(const Node< T > &start) constCXXGRAPH::Graph< T >virtual
    depth_first_search(const Node< T > &start) constCXXGRAPH::Graph< T >virtual
    dial(const Node< T > &source, int maxWeight) constCXXGRAPH::Graph< T >virtual
    dijkstra(const Node< T > &source, const Node< T > &target) constCXXGRAPH::Graph< T >virtual
    getAdjMatrix() constCXXGRAPH::Graph< T >virtual
    getEdge(unsigned long edgeId) constCXXGRAPH::Graph< T >virtual
    getEdgeSet() constCXXGRAPH::Graph< T >virtual
    getNodeSet() constCXXGRAPH::Graph< T >virtual
    getPartitionId() constCXXGRAPH::PARTITIONING::Partition< T >
    Graph()=default (defined in CXXGRAPH::Graph< T >)CXXGRAPH::Graph< T >
    Graph(const std::list< const Edge< T > * > &edgeSet) (defined in CXXGRAPH::Graph< T >)CXXGRAPH::Graph< T >
    isCyclicDirectedGraphBFS() constCXXGRAPH::Graph< T >virtual
    isCyclicDirectedGraphDFS() constCXXGRAPH::Graph< T >virtual
    isDirectedGraph() constCXXGRAPH::Graph< T >virtual
    Partition() (defined in CXXGRAPH::PARTITIONING::Partition< T >)CXXGRAPH::PARTITIONING::Partition< T >
    Partition(unsigned int partitionId) (defined in CXXGRAPH::PARTITIONING::Partition< T >)CXXGRAPH::PARTITIONING::Partition< T >
    Partition(const std::list< const Edge< T > * > &edgeSet) (defined in CXXGRAPH::PARTITIONING::Partition< T >)CXXGRAPH::PARTITIONING::Partition< T >
    Partition(unsigned int partitionId, const std::list< const Edge< T > * > &edgeSet) (defined in CXXGRAPH::PARTITIONING::Partition< T >)CXXGRAPH::PARTITIONING::Partition< T >
    partitionGraph(PARTITIONING::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) constCXXGRAPH::Graph< T >virtual
    readFromFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool readNodeFeat=false, bool readEdgeWeight=false)CXXGRAPH::Graph< T >virtual
    removeEdge(unsigned long edgeId)CXXGRAPH::Graph< T >virtual
    setEdgeSet(std::list< const Edge< T > * > &edgeSet)CXXGRAPH::Graph< T >virtual
    setPartitionId(unsigned int partitionId)CXXGRAPH::PARTITIONING::Partition< T >
    writeToFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) constCXXGRAPH::Graph< T >virtual
    ~Graph()=default (defined in CXXGRAPH::Graph< T >)CXXGRAPH::Graph< T >
    ~Partition()=default (defined in CXXGRAPH::PARTITIONING::Partition< T >)CXXGRAPH::PARTITIONING::Partition< T >
    + + + + diff --git a/docs/html/d7/d59/CoordinatedRecord_8hpp_source.html b/docs/html/d7/d59/CoordinatedRecord_8hpp_source.html new file mode 100644 index 000000000..282fb96de --- /dev/null +++ b/docs/html/d7/d59/CoordinatedRecord_8hpp_source.html @@ -0,0 +1,210 @@ + + + + + + + +CXXGraph: /github/workspace/include/Partitioning/CoordinatedRecord.hpp Source File + + + + + + + + + +
    +
    + + + + + + + +
    +
    CXXGraph +  0.1.6 +
    +
    CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
    +
    +
    + + + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    CoordinatedRecord.hpp
    +
    +
    +
    1 /***********************************************************/
    +
    2 /*** ______ ____ ______ _ ***/
    +
    3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
    +
    4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
    +
    5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
    +
    6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
    +
    7 /*** |_| ***/
    +
    8 /***********************************************************/
    +
    9 /*** Header-Only C++ Library for Graph ***/
    +
    10 /*** Representation and Algorithms ***/
    +
    11 /***********************************************************/
    +
    12 /*** Author: ZigRazor ***/
    +
    13 /*** E-Mail: zigrazor@gmail.com ***/
    +
    14 /***********************************************************/
    +
    15 /*** Collaboration: ----------- ***/
    +
    16 /***********************************************************/
    +
    17 /*** License: AGPL v3.0 ***/
    +
    18 /***********************************************************/
    +
    19 
    +
    20 #ifndef __CXXGRAPH_PARTITIONING_COORDINATEDRECORD_H__
    +
    21 #define __CXXGRAPH_PARTITIONING_COORDINATEDRECORD_H__
    +
    22 
    +
    23 #pragma once
    +
    24 
    +
    25 #include "Utility/Typedef.hpp"
    +
    26 
    +
    27 namespace CXXGRAPH
    +
    28 {
    +
    29  namespace PARTITIONING
    +
    30  {
    +
    31 
    +
    32  template <typename T>
    +
    33  class CoordinatedRecord : public Record<T>
    +
    34  {
    +
    35  private:
    +
    36  PartitionMap<T> partitions;
    +
    37  std::mutex lock;
    +
    38  int degree;
    +
    39 
    +
    40  public:
    + + +
    43 
    +
    44  PartitionMap<T> &getPartitions();
    +
    45  void addPartition(int m);
    +
    46  bool hasReplicaInPartition(int m);
    +
    47  bool getLock();
    +
    48  bool releaseLock();
    +
    49  int getReplicas();
    +
    50  int getDegree();
    +
    51  void incrementDegree();
    +
    52 
    +
    53  void addAll(std::set<int> &set);
    +
    54  static std::set<int> intersection(CoordinatedRecord &x, CoordinatedRecord &y);
    +
    55  };
    +
    56  template <typename T>
    +
    57  CoordinatedRecord<T>::CoordinatedRecord() : partitions(), lock()
    +
    58  {
    +
    59  degree = 0;
    +
    60  }
    +
    61  template <typename T>
    +
    62  CoordinatedRecord<T>::~CoordinatedRecord()
    +
    63  {
    +
    64  }
    +
    65  template <typename T>
    +
    66  PartitionMap<T> &CoordinatedRecord<T>::getPartitions()
    +
    67  {
    +
    68  return partitions;
    +
    69  }
    +
    70  template <typename T>
    +
    71  void CoordinatedRecord<T>::addPartition(int m)
    +
    72  {
    +
    73  if (m == -1)
    +
    74  {
    +
    75  std::cout << "ERROR! record.addPartition(-1)" << std::endl;
    +
    76  exit(-1);
    +
    77  }
    +
    78  partitions.insert(m);
    +
    79  }
    +
    80  template <typename T>
    +
    81  bool CoordinatedRecord<T>::hasReplicaInPartition(int m)
    +
    82  {
    +
    83  return partitions.find(m) != partitions.end();
    +
    84  }
    +
    85  template <typename T>
    +
    86  bool CoordinatedRecord<T>::getLock()
    +
    87  {
    +
    88  return lock.try_lock();
    +
    89  }
    +
    90  template <typename T>
    +
    91  bool CoordinatedRecord<T>::releaseLock()
    +
    92  {
    +
    93  lock.unlock();
    +
    94  return true;
    +
    95  }
    +
    96  template <typename T>
    +
    97  int CoordinatedRecord<T>::getReplicas()
    +
    98  {
    +
    99  return partitions.size();
    +
    100  }
    +
    101  template <typename T>
    +
    102  int CoordinatedRecord<T>::getDegree()
    +
    103  {
    +
    104  return degree;
    +
    105  }
    +
    106  template <typename T>
    +
    107  void CoordinatedRecord<T>::incrementDegree()
    +
    108  {
    +
    109  degree++;
    +
    110  }
    +
    111  template <typename T>
    +
    112  void CoordinatedRecord<T>::addAll(std::set<int> &set)
    +
    113  {
    +
    114  partitions.insert(set.begin(), set.end());
    +
    115  }
    +
    116  template <typename T>
    +
    117  std::set<int> CoordinatedRecord<T>::intersection(CoordinatedRecord &x, CoordinatedRecord &y)
    +
    118  {
    +
    119  std::set<int> result;
    +
    120  set_intersection(x.partitions.begin(), x.partitions.end(), y.partitions.begin(), y.partitions.end(),
    +
    121  std::inserter(result, result.begin()));
    +
    122  return result;
    +
    123  }
    +
    124  }
    +
    125 }
    +
    126 
    +
    127 #endif // __CXXGRAPH_PARTITIONING_COORDINATEDRECORD_H__
    +
    Definition: CoordinatedRecord.hpp:34
    +
    Definition: Record.hpp:29
    +
    + + + + diff --git a/docs/html/d7/d70/classCXXGRAPH_1_1PARTITIONING_1_1PartitioningStats-members.html b/docs/html/d7/d70/classCXXGRAPH_1_1PARTITIONING_1_1PartitioningStats-members.html new file mode 100644 index 000000000..0b7580a04 --- /dev/null +++ b/docs/html/d7/d70/classCXXGRAPH_1_1PARTITIONING_1_1PartitioningStats-members.html @@ -0,0 +1,98 @@ + + + + + + + +CXXGraph: Member List + + + + + + + + + +
    +
    + + + + + + + +
    +
    CXXGraph +  0.1.6 +
    +
    CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
    +
    +
    + + + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    CXXGRAPH::PARTITIONING::PartitioningStats Member List
    +
    +
    + +

    This is the complete list of members for CXXGRAPH::PARTITIONING::PartitioningStats, including all inherited members.

    + + + + + + + + + + + + + + + +
    balanceEdgesFactor (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    balanceNodesFactor (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    edgesReplicationFactor (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    maxEdgesLoad (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    maxNodesLoad (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    minEdgesLoad (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    minNodesLoad (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    nodesReplicationFactor (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    numberOfEdges (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    numberOfNodes (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    numberOfPartitions (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    operator<< (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStatsfriend
    replicatedEdgesCount (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    replicatedNodesCount (defined in CXXGRAPH::PARTITIONING::PartitioningStats)CXXGRAPH::PARTITIONING::PartitioningStats
    + + + + diff --git a/docs/html/d7/dc6/Node_8hpp_source.html b/docs/html/d7/dc6/Node_8hpp_source.html new file mode 100644 index 000000000..68c3f034f --- /dev/null +++ b/docs/html/d7/dc6/Node_8hpp_source.html @@ -0,0 +1,175 @@ + + + + + + + +CXXGraph: /github/workspace/include/Node/Node.hpp Source File + + + + + + + + + +
    +
    + + + + + + + +
    +
    CXXGraph +  0.1.6 +
    +
    CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
    +
    +
    + + + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    Node.hpp
    +
    +
    +
    1 /***********************************************************/
    +
    2 /*** ______ ____ ______ _ ***/
    +
    3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
    +
    4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
    +
    5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
    +
    6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
    +
    7 /*** |_| ***/
    +
    8 /***********************************************************/
    +
    9 /*** Header-Only C++ Library for Graph ***/
    +
    10 /*** Representation and Algorithms ***/
    +
    11 /***********************************************************/
    +
    12 /*** Author: ZigRazor ***/
    +
    13 /*** E-Mail: zigrazor@gmail.com ***/
    +
    14 /***********************************************************/
    +
    15 /*** Collaboration: ----------- ***/
    +
    16 /***********************************************************/
    +
    17 /*** License: AGPL v3.0 ***/
    +
    18 /***********************************************************/
    +
    19 
    +
    20 
    +
    21 #ifndef __NODE_H__
    +
    22 #define __NODE_H__
    +
    23 
    +
    24 #pragma once
    +
    25 #include <iostream>
    +
    26 
    +
    27 namespace CXXGRAPH
    +
    28 {
    +
    29  template <typename T>
    +
    30  class Node;
    +
    31  template <typename T>
    +
    32  std::ostream &operator<<(std::ostream &os, const Node<T> &node);
    +
    33  template <typename T>
    +
    34  class Node
    +
    35  {
    +
    36  private:
    +
    37  unsigned long id;
    +
    38  T data;
    +
    39 
    +
    40  public:
    +
    41  Node(const unsigned long id, const T &data);
    +
    42  ~Node() = default;
    +
    43  const unsigned long &getId() const;
    +
    44  const T &getData() const;
    +
    45  //operator
    +
    46  bool operator==(const Node<T> &b) const;
    +
    47  bool operator<(const Node<T> &b) const;
    +
    48  friend std::ostream &operator<<<>(std::ostream &os, const Node<T> &node);
    +
    49  };
    +
    50 
    +
    51  template <typename T>
    +
    52  Node<T>::Node(const unsigned long id, const T &data)
    +
    53  {
    +
    54  this->id = id;
    +
    55  this->data = data;
    +
    56  }
    +
    57 
    +
    58  template <typename T>
    +
    59  const unsigned long &Node<T>::getId() const
    +
    60  {
    +
    61  return id;
    +
    62  }
    +
    63 
    +
    64  template <typename T>
    +
    65  const T &Node<T>::getData() const
    +
    66  {
    +
    67  return data;
    +
    68  }
    +
    69 
    +
    70  template <typename T>
    +
    71  bool Node<T>::operator==(const Node<T> &b) const
    +
    72  {
    +
    73  return (this->id == b.id && this->data == b.data);
    +
    74  }
    +
    75 
    +
    76  template <typename T>
    +
    77  bool Node<T>::operator<(const Node<T> &b) const
    +
    78  {
    +
    79  return (this->id < b.id);
    +
    80  }
    +
    81 
    +
    82 
    +
    83  //ostream overload
    +
    84  template <typename T>
    +
    85  std::ostream &operator<<(std::ostream &os, const Node<T> &node)
    +
    86  {
    +
    87  os << "Node: {\n"
    +
    88  << " Id:\t" << node.id << "\n Data:\t" << node.data << "\n}";
    +
    89  return os;
    +
    90  }
    +
    91 }
    +
    92 
    +
    93 #endif // __NODE_H__
    +
    Definition: Node.hpp:35
    +
    + + + + diff --git a/docs/html/d7/dde/classCXXGRAPH_1_1Writer.html b/docs/html/d7/dde/classCXXGRAPH_1_1Writer.html index 030fe9618..0c5741d22 100644 --- a/docs/html/d7/dde/classCXXGRAPH_1_1Writer.html +++ b/docs/html/d7/dde/classCXXGRAPH_1_1Writer.html @@ -76,7 +76,7 @@
    -

    #include <Graph.hpp>

    +

    #include <Writer.hpp>

    @@ -139,7 +139,7 @@

    Graph.hpp +
  • /github/workspace/include/Utility/Writer.hpp
  • diff --git a/docs/html/d7/de1/ConstString_8hpp_source.html b/docs/html/d7/de1/ConstString_8hpp_source.html new file mode 100644 index 000000000..84c94c1d9 --- /dev/null +++ b/docs/html/d7/de1/ConstString_8hpp_source.html @@ -0,0 +1,115 @@ + + + + + + + +CXXGraph: /github/workspace/include/Utility/ConstString.hpp Source File + + + + + + + + + +
    +
    +

    Public Member Functions

    + + + + + + +
    +
    CXXGraph +  0.1.6 +
    +
    CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
    +
    +
    + + + + + + + + +
    +
    + + +
    + +
    + + + +
    +
    +
    ConstString.hpp
    +
    +
    +
    1 /***********************************************************/
    +
    2 /*** ______ ____ ______ _ ***/
    +
    3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
    +
    4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
    +
    5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
    +
    6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
    +
    7 /*** |_| ***/
    +
    8 /***********************************************************/
    +
    9 /*** Header-Only C++ Library for Graph ***/
    +
    10 /*** Representation and Algorithms ***/
    +
    11 /***********************************************************/
    +
    12 /*** Author: ZigRazor ***/
    +
    13 /*** E-Mail: zigrazor@gmail.com ***/
    +
    14 /***********************************************************/
    +
    15 /*** Collaboration: ----------- ***/
    +
    16 /***********************************************************/
    +
    17 /*** License: AGPL v3.0 ***/
    +
    18 /***********************************************************/
    +
    19 
    +
    20 #ifndef __CONSTSTRING_H__
    +
    21 #define __CONSTSTRING_H__
    +
    22 
    +
    23 #pragma once
    +
    24 
    +
    25 namespace CXXGRAPH
    +
    26 {
    +
    27  //STRING ERROR CONST EXPRESSION
    +
    28  constexpr char ERR_NO_DIR_OR_UNDIR_EDGE[] = "Edge are neither Directed neither Undirected";
    +
    29  constexpr char ERR_NO_WEIGHTED_EDGE[] = "Edge are not Weighted";
    +
    30  constexpr char ERR_TARGET_NODE_NOT_REACHABLE[] = "Target Node not Reachable";
    +
    31  constexpr char ERR_TARGET_NODE_NOT_IN_GRAPH[] = "Target Node not inside Graph";
    +
    32  constexpr char ERR_SOURCE_NODE_NOT_IN_GRAPH[] = "Source Node not inside Graph";
    +
    34 }
    +
    35 #endif // __CONSTSTRING_H__
    +
    + + + + diff --git a/docs/html/d8/d2b/Runnable_8hpp_source.html b/docs/html/d8/d2b/Runnable_8hpp_source.html new file mode 100644 index 000000000..b684a1a65 --- /dev/null +++ b/docs/html/d8/d2b/Runnable_8hpp_source.html @@ -0,0 +1,116 @@ + + + + + + + +CXXGraph: /github/workspace/include/Utility/Runnable.hpp Source File + + + + + + + + + +
    +
    + + + + + + + +
    +
    CXXGraph +  0.1.6 +
    +
    CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
    +
    +
    + + + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    Runnable.hpp
    +
    +
    +
    1 /***********************************************************/
    +
    2 /*** ______ ____ ______ _ ***/
    +
    3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
    +
    4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
    +
    5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
    +
    6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
    +
    7 /*** |_| ***/
    +
    8 /***********************************************************/
    +
    9 /*** Header-Only C++ Library for Graph ***/
    +
    10 /*** Representation and Algorithms ***/
    +
    11 /***********************************************************/
    +
    12 /*** Author: ZigRazor ***/
    +
    13 /*** E-Mail: zigrazor@gmail.com ***/
    +
    14 /***********************************************************/
    +
    15 /*** Collaboration: ----------- ***/
    +
    16 /***********************************************************/
    +
    17 /*** License: AGPL v3.0 ***/
    +
    18 /***********************************************************/
    +
    19 
    +
    20 #ifndef __CXXGRAPH_RUNNABLE_H__
    +
    21 #define __CXXGRAPH_RUNNABLE_H__
    +
    22 
    +
    23 #pragma once
    +
    24 
    +
    25 namespace CXXGRAPH
    +
    26 {
    +
    27  class Runnable
    +
    28  {
    +
    29  public:
    +
    30  virtual void run() = 0;
    +
    31  };
    +
    32 }
    +
    33 
    +
    34 #endif // __CXXGRAPH_RUNNABLE_H__
    +
    Definition: Runnable.hpp:28
    +
    + + + + diff --git a/docs/html/d8/d4b/classCXXGRAPH_1_1PARTITIONING_1_1Partitioner-members.html b/docs/html/d8/d4b/classCXXGRAPH_1_1PARTITIONING_1_1Partitioner-members.html new file mode 100644 index 000000000..ab879130b --- /dev/null +++ b/docs/html/d8/d4b/classCXXGRAPH_1_1PARTITIONING_1_1Partitioner-members.html @@ -0,0 +1,87 @@ + + + + + + + +CXXGraph: Member List + + + + + + + + + +
    +
    + + + + + + + +
    +
    CXXGraph +  0.1.6 +
    +
    CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
    +
    +
    + + + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    CXXGRAPH::PARTITIONING::Partitioner< T > Member List
    +
    +
    + +

    This is the complete list of members for CXXGRAPH::PARTITIONING::Partitioner< T >, including all inherited members.

    + + + + +
    Partitioner(std::vector< Edge< T >> &dataset, Globals &G) (defined in CXXGRAPH::PARTITIONING::Partitioner< T >)CXXGRAPH::PARTITIONING::Partitioner< T >
    performCoordinatedPartition() (defined in CXXGRAPH::PARTITIONING::Partitioner< T >)CXXGRAPH::PARTITIONING::Partitioner< T >
    ~Partitioner() (defined in CXXGRAPH::PARTITIONING::Partitioner< T >)CXXGRAPH::PARTITIONING::Partitioner< T >
    + + + + diff --git a/docs/html/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.map b/docs/html/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.map new file mode 100644 index 000000000..3ea66c752 --- /dev/null +++ b/docs/html/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.map @@ -0,0 +1,4 @@ + + + + diff --git a/docs/html/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.md5 b/docs/html/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.md5 new file mode 100644 index 000000000..567e0cbbd --- /dev/null +++ b/docs/html/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.md5 @@ -0,0 +1 @@ +aa7e9bcf9adf5f0ec33e547fa0857a92 \ No newline at end of file diff --git a/docs/html/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.png b/docs/html/d8/d63/classCXXGRAPH_1_1PARTITIONING_1_1Partition__inherit__graph.png new file mode 100644 index 0000000000000000000000000000000000000000..87631278a151f53d4e47937428fdd738221c1a8a GIT binary patch literal 6031 zcmch5Wl)sS+xH?3(u$;n2uQkg=PD`PBCW&%(zUR33R2Q7EiOxUgMff^NePmYB7!u} zVg57EJkLAt%=_(~o!$L#@1FbI=en+6MQW%i5E0N2Kp+qzB}JGP_#Opse>@!UnZ2*7 z4!&?KR1{#4o7-1zYjGk3@&Kj;lhyIc+*?E#=)8W2`}?4ygI!;il$2spYvwZyn>RiT zj#t+Zi1O;DJW_HJcF=Ztb%C5MTLLIi`msQlp+#FCFaK7k}ogIOgOo?A>>|&#$f)rWg-n=QAZVK;nc6F6^a}(I!-WHg% zvbKgFAD^7`F0~?v4kR9JS`nX}oq1iKZDPmrTlU_Kxf;J5Yxno(*Ey$(Ps3m=)vGdV&j0?B|99|%jrpVPL{U5%&HE%tnVDJ4?_9v} z<;#h$iELA=R1>Vi!YTIl_UuedfgBthC7(V;B_t&DFD+$z?9CNATEpQgd}*pzEk#9P zlw1ZfSz_)VKYijjb_tb}EiW%$TVH>sU92{h{_@CKhvR;hw10L>YwHssA-#jTbT4mj zO(Uc9&MWKP%poRT-dLaG?bp*#{m%xnmc7x?ozy19LM^+{?yNZhnd9T*wVyxb5GT81 z2IU&;{oUR2eh^(99gP&8S2lym+yxr!Hp?A>0&kZjVx+?6N_053XV45N<3_Er_ajml z(LVq7QONS0+&2FkDU4jpzW1dm^r9{yboBH}97zem!I)DsGw{D-f@;RbbZ6)1b+cjp z4UjZGHrHi{Eqp?|AzvX@u29ST^7N2qkei#^d1sotqxWjy%?WMzR=AWY@sN0qX*Q=&`b#-+m<>k-8?y?d4qHbHG z7=Gt}Wqo{_p3l$D8i%*@P^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;4lGP8$Zo8?X;wgyGRI??hK~T~)TWL84@+&T*8b#|1eG_l& zGCkDzncow?9l)fM4{*D>y5h34-#0XffG~(wH$OZa_szHTP|$&SrtQenwM6yk?P7H# zQc5jbB64fXhJ}^Y0`xgu_RUIjB{lz@A2HtyIR764-{zv_-!2(7T=a!(|M zgD#2X-ZY3kYLSMzoHEhS)k6dbsQ-JR9?1Ay6JBq&&JDI;;dLox3->HY*da>K)L`Xu HWquC literal 0 HcmV?d00001 diff --git a/docs/html/d8/d6d/classCXXGRAPH_1_1PARTITIONING_1_1Partitioner.html b/docs/html/d8/d6d/classCXXGRAPH_1_1PARTITIONING_1_1Partitioner.html new file mode 100644 index 000000000..b814138d0 --- /dev/null +++ b/docs/html/d8/d6d/classCXXGRAPH_1_1PARTITIONING_1_1Partitioner.html @@ -0,0 +1,97 @@ + + + + + + + +CXXGraph: CXXGRAPH::PARTITIONING::Partitioner< T > Class Template Reference + + + + + + + + + +
    +
    + + + + + + + +
    +
    CXXGraph +  0.1.6 +
    +
    CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
    +
    +
    + + + + + + + + +
    +
    + + +
    + +
    + + +
    +
    + +
    +
    CXXGRAPH::PARTITIONING::Partitioner< T > Class Template Reference
    +
    +
    + + + + + + +

    +Public Member Functions

    Partitioner (std::vector< Edge< T >> &dataset, Globals &G)
     
    +CoordinatedPartitionState< T > performCoordinatedPartition ()
     
    +
    The documentation for this class was generated from the following file: +
    + + + + diff --git a/docs/html/d8/d91/Partitioner_8hpp_source.html b/docs/html/d8/d91/Partitioner_8hpp_source.html new file mode 100644 index 000000000..6fe473303 --- /dev/null +++ b/docs/html/d8/d91/Partitioner_8hpp_source.html @@ -0,0 +1,190 @@ + + + + + + + +CXXGraph: /github/workspace/include/Partitioning/Partitioner.hpp Source File + + + + + + + + + +
    +
    + + + + + + + +
    +
    CXXGraph +  0.1.6 +
    +
    CXXGraph is a header only, that manages the Graphs and it's algorithm in C++
    +
    +
    + + + + + + + + +
    +
    + + +
    + +
    + + +
    +
    +
    +
    Partitioner.hpp
    +
    +
    +
    1 /***********************************************************/
    +
    2 /*** ______ ____ ______ _ ***/
    +
    3 /*** / ___\ \/ /\ \/ / ___|_ __ __ _ _ __ | |__ ***/
    +
    4 /*** | | \ / \ / | _| '__/ _` | '_ \| '_ \ ***/
    +
    5 /*** | |___ / \ / \ |_| | | | (_| | |_) | | | | ***/
    +
    6 /*** \____/_/\_\/_/\_\____|_| \__,_| .__/|_| |_| ***/
    +
    7 /*** |_| ***/
    +
    8 /***********************************************************/
    +
    9 /*** Header-Only C++ Library for Graph ***/
    +
    10 /*** Representation and Algorithms ***/
    +
    11 /***********************************************************/
    +
    12 /*** Author: ZigRazor ***/
    +
    13 /*** E-Mail: zigrazor@gmail.com ***/
    +
    14 /***********************************************************/
    +
    15 /*** Collaboration: ----------- ***/
    +
    16 /***********************************************************/
    +
    17 /*** License: AGPL v3.0 ***/
    +
    18 /***********************************************************/
    +
    19 
    +
    20 #ifndef __CXXGRAPH_PARTITIONING_PARTITIONER_H__
    +
    21 #define __CXXGRAPH_PARTITIONING_PARTITIONER_H__
    +
    22 
    +
    23 #pragma once
    +
    24 #include <vector>
    +
    25 #include "PartitionStrategy.hpp"
    +
    26 #include "Partitioning/Utility/Globals.hpp"
    +
    27 #include "Edge/Edge.hpp"
    +
    28 #include "CoordinatedPartitionState.hpp"
    +
    29 #include "Utility/Runnable.hpp"
    +
    30 #include "PartitionerThread.hpp"
    +
    31 #include "PartitionAlgorithm.hpp"
    +
    32 #include "HDRF.hpp"
    +
    33 
    +
    34 namespace CXXGRAPH
    +
    35 {
    +
    36  namespace PARTITIONING
    +
    37  {
    +
    38  template <typename T>
    + +
    40  {
    +
    41  private:
    +
    42  std::vector<Edge<T>> dataset;
    +
    43  PartitionStrategy<T> algorithm;
    +
    44  Globals GLOBALS;
    +
    45 
    +
    46  CoordinatedPartitionState<T> startCoordinated();
    +
    47 
    +
    48  public:
    +
    49  Partitioner(std::vector<Edge<T>> &dataset, Globals &G);
    +
    50  ~Partitioner();
    +
    51 
    +
    52  CoordinatedPartitionState<T> performCoordinatedPartition();
    +
    53  };
    +
    54  template <typename T>
    +
    55  Partitioner<T>::Partitioner(std::vector<Edge<T>> &dataset, Globals &G)
    +
    56  {
    +
    57  this->GLOBALS = G;
    +
    58  this->dataset = dataset;
    +
    59  if (GLOBALS.partitionStategy == PartitionAlgorithm::HDRF_ALG)
    +
    60  {
    +
    61  algorithm = new HDRF<T>(GLOBALS);
    +
    62  }
    +
    63  }
    +
    64  template <typename T>
    +
    65  CoordinatedPartitionState<T> Partitioner<T>::startCoordinated()
    +
    66  {
    +
    67  CoordinatedPartitionState state(GLOBALS);
    +
    68  int processors = GLOBALS.threads;
    +
    69 
    +
    70  std::thread myThreads[processors];
    +
    71 
    +
    72  int n = dataset.size();
    +
    73  int subSize = n / processors + 1;
    +
    74  for (int t = 0; t < processors; t++)
    +
    75  {
    +
    76  int iStart = t * subSize;
    +
    77  int iEnd = std::min((t + 1) * subSize, n);
    +
    78  if (iEnd >= iStart)
    +
    79  {
    +
    80  std::vector<Edge<T>> list(dataset.begin() + iStart, dataset.begin() + iEnd);
    +
    81  Runnable x = PartitionerThread<T>(list, state, algorithm, new std::list<int>());
    +
    82  myThreads[t] = std::thread(&Runnable::run, &x);
    +
    83  }
    +
    84  }
    +
    85  for (int t = 0; t < processors; t++)
    +
    86  {
    +
    87  myThreads[t].join();
    +
    88  }
    +
    89  return state;
    +
    90  }
    +
    91  template <typename T>
    +
    92  Partitioner<T>::~Partitioner()
    +
    93  {
    +
    94  }
    +
    95  template <typename T>
    +
    96  CoordinatedPartitionState<T> Partitioner<T>::performCoordinatedPartition()
    +
    97  {
    +
    98  return startCoordinated();
    +
    99  }
    +
    100  }
    +
    101 }
    +
    102 
    +
    103 #endif // __CXXGRAPH_PARTITIONING_PARTITIONER_H__
    +
    Definition: Edge.hpp:40
    +
    Definition: CoordinatedPartitionState.hpp:39
    +
    Definition: Globals.hpp:32
    +
    Definition: HDRF.hpp:35
    +
    Definition: PartitionStrategy.hpp:34
    +
    Definition: Partitioner.hpp:40
    +
    + + + + diff --git a/docs/html/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.map b/docs/html/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.map new file mode 100644 index 000000000..2181d134f --- /dev/null +++ b/docs/html/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.map @@ -0,0 +1,4 @@ + + + + diff --git a/docs/html/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.md5 b/docs/html/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.md5 new file mode 100644 index 000000000..b21f563b8 --- /dev/null +++ b/docs/html/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.md5 @@ -0,0 +1 @@ +df177e03bb17e95d798ac79b4c93d980 \ No newline at end of file diff --git a/docs/html/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.png b/docs/html/d8/dad/classCXXGRAPH_1_1PARTITIONING_1_1CoordinatedRecord__coll__graph.png new file mode 100644 index 0000000000000000000000000000000000000000..7fb4758cd371d186ef216b6ee3230e8a2780a4fe GIT binary patch literal 6846 zcmb_hcR1Dm-#*C-*(=%O*du!#TgNDSj}($k_Ke6*9IGTGo6Hm<4HO}JudHmcBjb5_ zzQ5}k*Y$h;dyWg2&p6(n_v?P$ulv4FjE)xiG65X{0)e=!uBM^~zkA?29v=&Sst?(m zpTM=&M5`dq&c9xMC`?8m=seX`6b<}dtY`WwPz>*Xb5k>EzC}t#rJ~Ba5lyJdM?j$Z znw8^Kt6WRrZ9_*fGscZjuIlL6u)g<*R^|+5)|a?Bbf)w5Ir%)N_O`rXk18XaKg$2| zo_dCgZdTr0tVs9lMjcE{2&S(KvEWB2As+sW_W9%51l_=4ZcO*zr_wE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RqxG!UE*OC=?0@ z2M4GL<{f$bNGP00O-%*-tZi&G`K;6V+{w#%^~(D8?c0uyV-pkfG&G!)1f$O4h)@OQ z%2DSWo%1*qdat@#IB&PPtE=qYJEPAJdxY6z6q}B>JK!*Gc<=BqkOhi{<|)ARw5#{a z7gkwWSyt9r$jl(pAR{B|&XzZJ7%0a(*=GhkO7frn@(hAr zn4AQ|EyB&s&CdSl1`@(*mcg5d(2ID)KpyncUiKi0XJ%$1BO}SI%#QXYDf<}rH(|<^BlON4ZfRTclS4^<*i$yVQxcm0k6HlCj|us&?wtG zJG?wRv2k$_kv^N%^aSZ!U0n@npL#NqdukPR?t@A2`Lx4`g#V2Z{+C-)tJ~r|%@V=4 zeVNEy2T%Dk8*iTCA@hNY8fhB>t9ypI?!P{mIrm-*XBYOFNwKdHnZZW^@WGU-mP)zO H?Xdp + + + diff --git a/docs/html/d9/d11/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__coll__graph.md5 b/docs/html/d9/d11/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__coll__graph.md5 new file mode 100644 index 000000000..816c1bc7a --- /dev/null +++ b/docs/html/d9/d11/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__coll__graph.md5 @@ -0,0 +1 @@ +e2f76fb6661b9a3c8ee9967d3c5fda19 \ No newline at end of file diff --git a/docs/html/d9/d11/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__coll__graph.png b/docs/html/d9/d11/classCXXGRAPH_1_1PARTITIONING_1_1HDRF__coll__graph.png new file mode 100644 index 0000000000000000000000000000000000000000..e0332e3221edbc37f283c54cc2650323c97e727e GIT binary patch literal 6630 zcmcgxbyQW|wm*b`gn+<7LIF`qLJ$$@PNfl0N;*YJ>5>u&X{1Y}C8fI?q#KcrBOxuk z>AT;(TR|F|3NE6^v;vx_T0$CXe75F^}-yt~Y@Kbio@b3#) z2J+Gph|9lUsdd?r2n0oftc0lA+r;f8S6VXX%Z`SQs!D3^F^>c*`6!iVL)PD= znqT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_8hpp_source.html b/docs/html/d9/d69/Graph_8hpp_source.html index df4495bfb..9ad502ff2 100644 --- a/docs/html/d9/d69/Graph_8hpp_source.html +++ b/docs/html/d9/d69/Graph_8hpp_source.html @@ -5,7 +5,7 @@ -CXXGraph: /github/workspace/include/Graph.hpp Source File +CXXGraph: /github/workspace/include/Graph/Graph.hpp Source File @@ -64,7 +64,7 @@
@@ -91,8 +91,8 @@
17 /*** License: AGPL v3.0 ***/
18 /***********************************************************/
19 
-
20 #ifndef __CXXGRAPH_H__
-
21 #define __CXXGRAPH_H__
+
20 #ifndef __GRAPH_H__
+
21 #define __GRAPH_H__
22 
23 #pragma once
24 
@@ -110,2379 +110,1380 @@
36 #include <fstream>
37 #include <limits.h>
38 #include <mutex>
-
39 #include "zlib.h"
-
40 
-
41 namespace CXXGRAPH
-
42 {
-
43  //STRING ERROR CONST EXPRESSION
-
44  constexpr char ERR_NO_DIR_OR_UNDIR_EDGE[] = "Edge are neither Directed neither Undirected";
-
45  constexpr char ERR_NO_WEIGHTED_EDGE[] = "Edge are not Weighted";
-
46  constexpr char ERR_TARGET_NODE_NOT_REACHABLE[] = "Target Node not Reachable";
-
47  constexpr char ERR_TARGET_NODE_NOT_IN_GRAPH[] = "Target Node not inside Graph";
-
48  constexpr char ERR_SOURCE_NODE_NOT_IN_GRAPH[] = "Source Node not inside Graph";
-
50  constexpr double INF_DOUBLE = std::numeric_limits<double>::max();
-
51  template <typename T>
-
52  class Node;
-
53  template <typename T>
-
54  class Edge;
-
55  template <typename T>
-
56  class DirectedEdge;
-
57  template <typename T>
-
58  class UndirectedEdge;
-
59  template <typename T>
-
60  class DirectedWeightedEdge;
-
61  template <typename T>
-
62  class UndirectedWeightedEdge;
-
63  template <typename T>
-
64  class Graph;
-
65  template <typename T>
-
66  class Partition;
+
39 #include <set>
+
40 #include <atomic>
+
41 #include <thread>
+
42 #include <cmath>
+
43 #include "zlib.h"
+
44 
+
45 #include "Edge/Weighted.hpp"
+
46 #include "Node/Node.hpp"
+
47 #include "Edge/Edge.hpp"
+
48 #include "Edge/DirectedEdge.hpp"
+
49 #include "Edge/UndirectedEdge.hpp"
+
50 #include "Edge/DirectedWeightedEdge.hpp"
+
51 #include "Edge/UndirectedWeightedEdge.hpp"
+
52 #include "Utility/ThreadSafe.hpp"
+
53 #include "Utility/Writer.hpp"
+
54 #include "Utility/Reader.hpp"
+
55 #include "Utility/ConstString.hpp"
+
56 #include "Utility/ConstValue.hpp"
+
57 #include "Utility/Typedef.hpp"
+
58 #include "Partitioning/Partition.hpp"
+
59 #include "Partitioning/PartitionAlgorithm.hpp"
+
60 
+
61 namespace CXXGRAPH
+
62 {
+
63  namespace PARTITIONING{
+
64  template<typename T>
+
65  class Partition;
+
66  }
67 
-
68  class Weighted;
-
69 
-
70  class ThreadSafe;
-
71 
-
72  template <typename T>
-
73  class Writer;
+
68  template <typename T>
+
69  std::ostream &operator<<(std::ostream &o, const Graph<T> &graph);
+
70  template <typename T>
+
71  std::ostream &operator<<(std::ostream &o, const AdjacencyMatrix<T> &adj);
+
72 
74  template <typename T>
-
75  class Reader;
-
76 
- -
79  {
-
80  bool success; // TRUE if the function does not return error, FALSE otherwise
-
81  std::string errorMessage; //message of error
-
82  double result; //result (valid only if success is TRUE)
-
83  };
- -
85 
- -
88  {
-
89  bool success; // TRUE if the function does not return error, FALSE otherwise
-
90  std::string errorMessage; //message of error
-
91  std::map<unsigned long, long> minDistanceMap; //result a map that contains the node id and the minumum distance from source (valid only if success is TRUE)
-
92  };
- -
94 
- -
97  {
-
98  unsigned int numberOfPartitions; // The number of Partitions
-
99  unsigned int numberOfNodes; // The number of Nodes
-
100  unsigned int replicatedNodesCount; // The number of Nodes that are replicated
-
101  unsigned int numberOfEdges; // The number of edges
-
102  unsigned int replicatedEdgesCount; // The number of edges that are replicated
-
103  unsigned int maxEdgesLoad; // Maximum edges load of the partitions
-
104  unsigned int minEdgesLoad; // Minimun edges load of the partitions
-
105  unsigned int maxNodesLoad; // Maximum nodes load of the partitions
-
106  unsigned int minNodesLoad; // Minimun nodes load of the partitions
-
107  double balanceEdgesFactor; // The balance edges factor of the partitions (maxEdgesLoad - minEdgesLoad) / (maxEdgesLoad), 0 is the optimal partitioning
-
108  double balanceNodesFactor; // The balance edges factor of the partitions (maxNodesLoad - minNodesLoad) / (maxNodesLoad), 0 is the optimal partitioning
-
109  double nodesReplicationFactor; // The replication factor of the Nodes (replicatedNodesCount / numberOfNodes), 1 is the optimal partitioning
-
110  double edgesReplicationFactor; // The replication factor of the edges (replicatedEdgesCount / numberOfEdges), 1 is the optimal partitioning
-
111 
-
112  friend std::ostream &operator<<(std::ostream &os, const PartitioningStats_struct &partitionStats)
-
113  {
-
114  os << "Partitioning Stats:\n";
-
115  os << "\tNumber of Partitions: " << partitionStats.numberOfPartitions << "\n";
-
116  os << "\tNumber of Nodes: " << partitionStats.numberOfNodes << "\n";
-
117  os << "\tNumber of Edges: " << partitionStats.numberOfEdges << "\n";
-
118  os << "\tNumber of Nodes Replica: " << partitionStats.replicatedNodesCount << "\n";
-
119  os << "\tNumber of Edges Replica: " << partitionStats.replicatedEdgesCount << "\n";
-
120  os << "\tNodes Replication Factor: " << partitionStats.nodesReplicationFactor << "\n";
-
121  os << "\tEdges Replication Factor: " << partitionStats.edgesReplicationFactor << "\n";
-
122  os << "\tMax Edges Load: " << partitionStats.maxEdgesLoad << "\n";
-
123  os << "\tMin Edges Load: " << partitionStats.minEdgesLoad << "\n";
-
124  os << "\tBalance Edges Factor: " << partitionStats.balanceEdgesFactor << "\n";
-
125  os << "\tMax Nodes Load: " << partitionStats.maxNodesLoad << "\n";
-
126  os << "\tMin Nodes Load: " << partitionStats.minNodesLoad << "\n";
-
127  os << "\tBalance Nodes Factor: " << partitionStats.balanceNodesFactor << "\n";
-
128  return os;
-
129  }
-
130  };
- -
132 
-
133  template <typename T>
-
134  using AdjacencyMatrix = std::map<const Node<T> *, std::vector<std::pair<const Node<T> *, const Edge<T> *>>>;
-
135 
-
136  template <typename T>
-
137  std::ostream &operator<<(std::ostream &o, const Node<T> &node);
-
138  template <typename T>
-
139  std::ostream &operator<<(std::ostream &o, const Edge<T> &edge);
-
140  template <typename T>
-
141  std::ostream &operator<<(std::ostream &o, const DirectedEdge<T> &edge);
-
142  template <typename T>
-
143  std::ostream &operator<<(std::ostream &o, const UndirectedEdge<T> &edge);
-
144  template <typename T>
-
145  std::ostream &operator<<(std::ostream &o, const DirectedWeightedEdge<T> &edge);
-
146  template <typename T>
-
147  std::ostream &operator<<(std::ostream &o, const UndirectedWeightedEdge<T> &edge);
-
148  template <typename T>
-
149  std::ostream &operator<<(std::ostream &o, const Graph<T> &graph);
-
150  template <typename T>
-
151  std::ostream &operator<<(std::ostream &o, const AdjacencyMatrix<T> &adj);
-
152  template <typename T>
-
153  using PartitionMap = std::map<unsigned int, Partition<T> *>;
-
154 
-
155  template <typename T>
-
156  class Node
-
157  {
-
158  private:
-
159  unsigned long id;
-
160  T data;
-
161 
-
162  public:
-
163  Node(const unsigned long id, const T &data);
-
164  ~Node() = default;
-
165  const unsigned long &getId() const;
-
166  const T &getData() const;
-
167  //operator
-
168  bool operator==(const Node<T> &b) const;
-
169  bool operator<(const Node<T> &b) const;
-
170  friend std::ostream &operator<<<>(std::ostream &os, const Node<T> &node);
-
171  };
-
172 
-
173  template <typename T>
-
174  Node<T>::Node(const unsigned long id, const T &data)
-
175  {
-
176  this->id = id;
-
177  this->data = data;
-
178  }
-
179 
-
180  template <typename T>
-
181  const unsigned long &Node<T>::getId() const
-
182  {
-
183  return id;
-
184  }
-
185 
-
186  template <typename T>
-
187  const T &Node<T>::getData() const
-
188  {
-
189  return data;
-
190  }
-
191 
-
192  template <typename T>
-
193  bool Node<T>::operator==(const Node<T> &b) const
-
194  {
-
195  return (this->id == b.id && this->data == b.data);
-
196  }
-
197 
-
198  template <typename T>
-
199  bool Node<T>::operator<(const Node<T> &b) const
-
200  {
-
201  return (this->id < b.id);
-
202  }
-
203 
-
204  class Weighted
-
205  {
-
206  private:
-
207  double weight;
-
208 
-
209  public:
-
210  Weighted();
-
211  Weighted(const double weight);
-
212  virtual ~Weighted() = default;
-
213  double getWeight() const;
-
214  void setWeight(const double weight);
-
215  };
-
216 
-
217  //inline because the implementation of non-template function in header file
-
218  inline Weighted::Weighted()
-
219  {
-
220  weight = 0.0;
-
221  }
-
222 
-
223  //inline because the implementation of non-template function in header file
-
224  inline Weighted::Weighted(const double weight)
-
225  {
-
226  this->weight = weight;
-
227  }
-
228 
-
229  //inline because the implementation of non-template function in header file
-
230  inline double Weighted::getWeight() const
-
231  {
-
232  return weight;
-
233  }
-
234 
-
235  //inline because the implementation of non-template function in header file
-
236  inline void Weighted::setWeight(const double weight)
-
237  {
-
238  this->weight = weight;
-
239  }
-
240 
- -
242  {
-
243  public:
-
244  void getLock() const;
-
245  void releaseLock() const;
-
246 
-
247  protected:
-
248  mutable std::mutex mutex;
-
249  };
-
250  //inline because the implementation of non-template function in header file
-
251  inline void ThreadSafe::getLock() const
-
252  {
-
253  mutex.lock();
-
254  }
-
255  //inline because the implementation of non-template function in header file
-
256  inline void ThreadSafe::releaseLock() const
-
257  {
-
258  mutex.unlock();
-
259  }
-
260 
-
261  template <typename T>
-
262  class Edge
-
263  {
-
264  private:
-
265  unsigned long id;
-
266  std::pair<const Node<T> *, const Node<T> *> nodePair;
-
267 
-
268  public:
-
269  Edge(const unsigned long id, const Node<T> &node1, const Node<T> &node2);
-
270  Edge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair);
-
271  virtual ~Edge() = default;
-
272  const unsigned long &getId() const;
-
273  const std::pair<const Node<T> *, const Node<T> *> &getNodePair() const;
-
274  virtual const std::optional<bool> isDirected() const;
-
275  virtual const std::optional<bool> isWeighted() const;
-
276  //operator
-
277  virtual bool operator==(const Edge<T> &b) const;
-
278  bool operator<(const Edge<T> &b) const;
-
279  //operator DirectedEdge<T>() const { return DirectedEdge<T>(id, nodePair); }
-
280  //operator UndirectedEdge<T>() const { return UndirectedEdge<T>(id, nodePair); }
-
281 
-
282  friend std::ostream &operator<<<>(std::ostream &os, const Edge<T> &edge);
-
283  };
-
284 
-
285  template <typename T>
-
286  Edge<T>::Edge(const unsigned long id, const Node<T> &node1, const Node<T> &node2) : nodePair(&node1, &node2)
-
287  {
-
288  this->id = id;
-
289  }
-
290 
-
291  template <typename T>
-
292  Edge<T>::Edge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair) : nodePair(nodepair)
-
293  {
-
294  this->id = id;
-
295  }
-
296 
-
297  template <typename T>
-
298  const unsigned long &Edge<T>::getId() const
-
299  {
-
300  return id;
-
301  }
-
302 
-
303  template <typename T>
-
304  const std::pair<const Node<T> *, const Node<T> *> &Edge<T>::getNodePair() const
-
305  {
-
306  return nodePair;
-
307  }
-
308 
-
309  template <typename T>
-
310  const std::optional<bool> Edge<T>::isDirected() const
-
311  {
-
312  return std::nullopt;
-
313  }
-
314 
-
315  template <typename T>
-
316  const std::optional<bool> Edge<T>::isWeighted() const
-
317  {
-
318  return std::nullopt;
-
319  }
-
320 
-
321  template <typename T>
-
322  bool Edge<T>::operator==(const Edge<T> &b) const
-
323  {
-
324  return (this->id == b.id && this->nodePair == b.nodePair);
-
325  }
-
326 
-
327  template <typename T>
-
328  bool Edge<T>::operator<(const Edge<T> &b) const
-
329  {
-
330  return (this->id < b.id);
-
331  }
-
332 
-
333  template <typename T>
-
334  class DirectedEdge : public Edge<T>
-
335  {
-
336  public:
-
337  DirectedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2);
-
338  DirectedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair);
-
339  DirectedEdge(const Edge<T> &edge);
-
340  virtual ~DirectedEdge() = default;
-
341  const Node<T> &getFrom() const;
-
342  const Node<T> &getTo() const;
-
343  const std::optional<bool> isDirected() const override;
-
344  const std::optional<bool> isWeighted() const override;
-
345  //operator
-
346  explicit operator UndirectedEdge<T>() const { return UndirectedEdge<T>(Edge<T>::getId(), Edge<T>::getNodePair()); }
-
347 
-
348  friend std::ostream &operator<<<>(std::ostream &os, const DirectedEdge<T> &edge);
-
349  };
-
350 
-
351  template <typename T>
-
352  DirectedEdge<T>::DirectedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2) : Edge<T>(id, node1, node2)
-
353  {
-
354  }
-
355 
-
356  template <typename T>
-
357  DirectedEdge<T>::DirectedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair) : Edge<T>(id, nodepair)
-
358  {
-
359  }
-
360 
-
361  template <typename T>
-
362  DirectedEdge<T>::DirectedEdge(const Edge<T> &edge) : DirectedEdge(edge.getId(), *(edge.getNodePair().first), *(edge.getNodePair().second))
-
363  {
-
364  }
-
365 
-
366  template <typename T>
-
367  const Node<T> &DirectedEdge<T>::getFrom() const
-
368  {
-
369  return *(Edge<T>::getNodePair().first);
-
370  }
-
371 
-
372  template <typename T>
-
373  const Node<T> &DirectedEdge<T>::getTo() const
-
374  {
-
375  return *(Edge<T>::getNodePair().second);
-
376  }
-
377 
-
378  template <typename T>
-
379  const std::optional<bool> DirectedEdge<T>::isDirected() const
-
380  {
-
381  return true;
-
382  }
-
383 
-
384  template <typename T>
-
385  const std::optional<bool> DirectedEdge<T>::isWeighted() const
-
386  {
-
387  return false;
-
388  }
-
389 
-
390  template <typename T>
-
391  class UndirectedEdge : public Edge<T>
-
392  {
-
393  public:
-
394  UndirectedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2);
-
395  UndirectedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair);
-
396  UndirectedEdge(const Edge<T> &edge);
-
397  virtual ~UndirectedEdge() = default;
-
398  const Node<T> &getNode1() const;
-
399  const Node<T> &getNode2() const;
-
400  const std::optional<bool> isDirected() const override;
-
401  const std::optional<bool> isWeighted() const override;
-
402  //operator
-
403  explicit operator DirectedEdge<T>() const { return DirectedEdge<T>(Edge<T>::getId(), Edge<T>::getNodePair()); }
-
404 
-
405  friend std::ostream &operator<<<>(std::ostream &os, const UndirectedEdge<T> &edge);
-
406  };
+
75  class Graph
+
76  {
+
77  private:
+
78  std::list<const Edge<T> *> edgeSet;
+
79  void addElementToAdjMatrix(AdjacencyMatrix<T> &adjMatrix, const Node<T> *nodeFrom, const Node<T> *nodeTo, const Edge<T> *edge) const;
+
80  int writeToStandardFile_csv(const std::string &workingDir, const std::string &OFileName, bool compress, bool writeNodeFeat, bool writeEdgeWeight) const;
+
81  int readFromStandardFile_csv(const std::string &workingDir, const std::string &OFileName, bool compress, bool readNodeFeat, bool readEdgeWeight);
+
82  int writeToStandardFile_tsv(const std::string &workingDir, const std::string &OFileName, bool compress, bool writeNodeFeat, bool writeEdgeWeight) const;
+
83  int readFromStandardFile_tsv(const std::string &workingDir, const std::string &OFileName, bool compress, bool readNodeFeat, bool readEdgeWeight);
+
84  void recreateGraphFromReadFiles(std::map<unsigned long, std::pair<unsigned long, unsigned long>> &edgeMap, std::map<unsigned long, bool> &edgeDirectedMap, std::map<unsigned long, T> &nodeFeatMap, std::map<unsigned long, double> &edgeWeightMap);
+
85  int compressFile(const std::string &inputFile, const std::string &outputFile) const;
+
86  int decompressFile(const std::string &inputFile, const std::string &outputFile) const;
+
87  void greedyPartition(PartitionMap<T> &partitionMap) const;
+
88  void HDRFPartition(PartitionMap<T> &partitionMap) const;
+
89 
+
90  public:
+
91  Graph() = default;
+
92  Graph(const std::list<const Edge<T> *> &edgeSet);
+
93  ~Graph() = default;
+
102  virtual const std::list<const Edge<T> *> &getEdgeSet() const;
+
111  virtual void setEdgeSet(std::list<const Edge<T> *> &edgeSet);
+
120  virtual void addEdge(const Edge<T> *edge);
+
129  virtual void removeEdge(unsigned long edgeId);
+
138  virtual const std::list<const Node<T> *> getNodeSet() const;
+
148  virtual const std::optional<const Edge<T> *> getEdge(unsigned long edgeId) const;
+
154  virtual const AdjacencyMatrix<T> getAdjMatrix() const;
+
167  virtual const DijkstraResult dijkstra(const Node<T> &source, const Node<T> &target) const;
+
178  virtual const std::vector<Node<T>> breadth_first_search(const Node<T> &start) const;
+
189  virtual const std::vector<Node<T>> depth_first_search(const Node<T> &start) const;
+
190 
+
199  virtual bool isCyclicDirectedGraphDFS() const;
+
200 
+
209  virtual bool isCyclicDirectedGraphBFS() const;
+
210 
+
218  virtual bool isDirectedGraph() const;
+
219 
+
246  virtual const DialResult dial(const Node<T> &source, int maxWeight) const;
+
247 
+
261  virtual int writeToFile(InputOutputFormat format = InputOutputFormat::STANDARD_CSV, const std::string &workingDir = ".", const std::string &OFileName = "graph", bool compress = false, bool writeNodeFeat = false, bool writeEdgeWeight = false) const;
+
262 
+
276  virtual int readFromFile(InputOutputFormat format = InputOutputFormat::STANDARD_CSV, const std::string &workingDir = ".", const std::string &OFileName = "graph", bool compress = false, bool readNodeFeat = false, bool readEdgeWeight = false);
+
277 
+
287  virtual PartitionMap<T> partitionGraph(PARTITIONING::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const;
+
288 
+
289  friend std::ostream &operator<<<>(std::ostream &os, const Graph<T> &graph);
+
290  friend std::ostream &operator<<<>(std::ostream &os, const AdjacencyMatrix<T> &adj);
+
291  };
+
292 
+
293  template <typename T>
+
294  Graph<T>::Graph(const std::list<const Edge<T> *> &edgeSet)
+
295  {
+
296  for (auto edgeSetIt = edgeSet.begin(); edgeSetIt != edgeSet.end(); ++edgeSetIt)
+
297  {
+
298  if (std::find_if(this->edgeSet.begin(), this->edgeSet.end(), [edgeSetIt](const Edge<T> *edge)
+
299  { return (*edge == **edgeSetIt); }) == this->edgeSet.end())
+
300  {
+
301  this->edgeSet.push_back(*edgeSetIt);
+
302  }
+
303  }
+
304  }
+
305 
+
306  template <typename T>
+
307  const std::list<const Edge<T> *> &Graph<T>::getEdgeSet() const
+
308  {
+
309  return edgeSet;
+
310  }
+
311 
+
312  template <typename T>
+
313  void Graph<T>::setEdgeSet(std::list<const Edge<T> *> &edgeSet)
+
314  {
+
315  this->edgeSet.clear();
+
316  for (auto edgeSetIt = edgeSet.begin(); edgeSetIt != edgeSet.end(); ++edgeSetIt)
+
317  {
+
318  if (std::find_if(this->edgeSet.begin(), this->edgeSet.end(), [edgeSetIt](const Edge<T> *edge)
+
319  { return (*edge == **edgeSetIt); }) == this->edgeSet.end())
+
320  {
+
321  this->edgeSet.push_back(*edgeSetIt);
+
322  }
+
323  }
+
324  }
+
325 
+
326  template <typename T>
+
327  void Graph<T>::addEdge(const Edge<T> *edge)
+
328  {
+
329  if (std::find_if(edgeSet.begin(), edgeSet.end(), [edge](const Edge<T> *edge_a)
+
330  { return (*edge == *edge_a); }) == edgeSet.end())
+
331  {
+
332  edgeSet.push_back(edge);
+
333  }
+
334  }
+
335 
+
336  template <typename T>
+
337  void Graph<T>::removeEdge(unsigned long edgeId)
+
338  {
+
339  auto edgeOpt = Graph<T>::getEdge(edgeId);
+
340  if (edgeOpt.has_value())
+
341  {
+
342  edgeSet.erase(std::find_if(this->edgeSet.begin(), this->edgeSet.end(), [edgeOpt](const Edge<T> *edge)
+
343  { return (*(edgeOpt.value()) == *edge); }));
+
344  }
+
345  }
+
346 
+
347  template <typename T>
+
348  const std::list<const Node<T> *> Graph<T>::getNodeSet() const
+
349  {
+
350  std::list<const Node<T> *> nodeSet;
+
351  for (auto edge : edgeSet)
+
352  {
+
353  if (std::find_if(nodeSet.begin(), nodeSet.end(), [edge](const Node<T> *node)
+
354  { return (*edge->getNodePair().first == *node); }) == nodeSet.end())
+
355  {
+
356  nodeSet.push_back(edge->getNodePair().first);
+
357  }
+
358  if (std::find_if(nodeSet.begin(), nodeSet.end(), [edge](const Node<T> *node)
+
359  { return (*edge->getNodePair().second == *node); }) == nodeSet.end())
+
360  {
+
361  nodeSet.push_back(edge->getNodePair().second);
+
362  }
+
363  }
+
364  return nodeSet;
+
365  }
+
366 
+
367  template <typename T>
+
368  const std::optional<const Edge<T> *> Graph<T>::getEdge(unsigned long edgeId) const
+
369  {
+
370 
+
371  auto it = edgeSet.begin();
+
372  for (it; it != edgeSet.end(); ++it)
+
373  {
+
374  if ((*it)->getId() == edgeId)
+
375  {
+
376  return *it;
+
377  }
+
378  }
+
379 
+
380  return std::nullopt;
+
381  }
+
382 
+
383  template <typename T>
+
384  void Graph<T>::addElementToAdjMatrix(AdjacencyMatrix<T> &adjMatrix, const Node<T> *nodeFrom, const Node<T> *nodeTo, const Edge<T> *edge) const
+
385  {
+
386  std::pair<const Node<T> *, const Edge<T> *> elem = {nodeTo, edge};
+
387  adjMatrix[nodeFrom].push_back(elem);
+
388 
+
389  //adjMatrix[nodeFrom.getId()].push_back(std::make_pair<const Node<T>,const Edge<T>>(nodeTo, edge));
+
390  }
+
391 
+
392  template <typename T>
+
393  int Graph<T>::writeToStandardFile_csv(const std::string &workingDir, const std::string &OFileName, bool compress, bool writeNodeFeat, bool writeEdgeWeight) const
+
394  {
+
395  std::ofstream ofileGraph;
+
396  std::string completePathToFileGraph = workingDir + "/" + OFileName + ".csv";
+
397  ofileGraph.open(completePathToFileGraph);
+
398  if (!ofileGraph.is_open())
+
399  {
+
400  // ERROR File Not Open
+
401  return -1;
+
402  }
+
403  auto printOutGraph = [&ofileGraph](const Edge<T> *e)
+
404  { ofileGraph << e->getId() << "," << e->getNodePair().first->getId() << "," << e->getNodePair().second->getId() << "," << ((e->isDirected().has_value() && e->isDirected().value()) ? 1 : 0) << std::endl; };
+
405  std::for_each(edgeSet.cbegin(), edgeSet.cend(), printOutGraph);
+
406  ofileGraph.close();
407 
-
408  template <typename T>
-
409  UndirectedEdge<T>::UndirectedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2) : Edge<T>(id, node1, node2)
-
410  {
-
411  }
-
412 
-
413  template <typename T>
-
414  UndirectedEdge<T>::UndirectedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair) : Edge<T>(id, nodepair)
-
415  {
-
416  }
-
417 
-
418  template <typename T>
-
419  UndirectedEdge<T>::UndirectedEdge(const Edge<T> &edge) : UndirectedEdge(edge.getId(), *(edge.getNodePair().first), *(edge.getNodePair().second))
-
420  {
-
421  }
-
422 
-
423  template <typename T>
-
424  const Node<T> &UndirectedEdge<T>::getNode1() const
-
425  {
-
426  return *(Edge<T>::getNodePair().first);
-
427  }
-
428 
-
429  template <typename T>
-
430  const Node<T> &UndirectedEdge<T>::getNode2() const
-
431  {
-
432  return *(Edge<T>::getNodePair().second);
-
433  }
-
434 
-
435  template <typename T>
-
436  const std::optional<bool> UndirectedEdge<T>::isDirected() const
-
437  {
-
438  return false;
-
439  }
-
440 
-
441  template <typename T>
-
442  const std::optional<bool> UndirectedEdge<T>::isWeighted() const
-
443  {
-
444  return false;
-
445  }
-
446 
-
447  template <typename T>
-
448  class DirectedWeightedEdge : public DirectedEdge<T>, public Weighted
-
449  {
-
450  public:
-
451  DirectedWeightedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2, const double weight);
-
452  DirectedWeightedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair, const double weight);
-
453  DirectedWeightedEdge(const DirectedEdge<T> &edge, const double weight);
-
454  DirectedWeightedEdge(const Edge<T> &edge, const double weight);
- -
456  DirectedWeightedEdge(const Edge<T> &edge);
- -
458  virtual ~DirectedWeightedEdge() = default;
-
459  const std::optional<bool> isWeighted() const override;
-
460  //operator
-
461  explicit operator UndirectedWeightedEdge<T>() const { return UndirectedWeightedEdge<T>(Edge<T>::getId(), Edge<T>::getNodePair(), Weighted::getWeight()); }
-
462 
-
463  friend std::ostream &operator<<<>(std::ostream &os, const DirectedWeightedEdge<T> &edge);
-
464  };
-
465 
-
466  template <typename T>
-
467  DirectedWeightedEdge<T>::DirectedWeightedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2, const double weight) : DirectedEdge<T>(id, node1, node2), Weighted(weight)
-
468  {
-
469  }
-
470 
-
471  template <typename T>
-
472  DirectedWeightedEdge<T>::DirectedWeightedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair, const double weight) : DirectedEdge<T>(id, nodepair), Weighted(weight)
-
473  {
-
474  }
-
475 
-
476  template <typename T>
-
477  DirectedWeightedEdge<T>::DirectedWeightedEdge(const DirectedEdge<T> &edge, const double weight) : DirectedEdge<T>(edge), Weighted(weight)
-
478  {
-
479  }
-
480 
-
481  template <typename T>
-
482  DirectedWeightedEdge<T>::DirectedWeightedEdge(const Edge<T> &edge, const double weight) : DirectedEdge<T>(edge), Weighted(weight)
-
483  {
-
484  }
-
485 
-
486  template <typename T>
-
487  DirectedWeightedEdge<T>::DirectedWeightedEdge(const DirectedEdge<T> &edge) : DirectedEdge<T>(edge), Weighted()
-
488  {
-
489  }
-
490 
-
491  template <typename T>
-
492  DirectedWeightedEdge<T>::DirectedWeightedEdge(const Edge<T> &edge) : DirectedEdge<T>(edge), Weighted()
-
493  {
-
494  }
-
495 
-
496  template <typename T>
-
497  DirectedWeightedEdge<T>::DirectedWeightedEdge(const UndirectedWeightedEdge<T> &edge) : DirectedEdge<T>(edge), Weighted(edge.getWeight())
-
498  {
-
499  }
-
500 
-
501  template <typename T>
-
502  const std::optional<bool> DirectedWeightedEdge<T>::isWeighted() const
-
503  {
-
504  return true;
-
505  }
-
506 
-
507  template <typename T>
- -
509  {
-
510  public:
-
511  UndirectedWeightedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2, const double weight);
-
512  UndirectedWeightedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair, const double weight);
-
513  UndirectedWeightedEdge(const UndirectedEdge<T> &edge, const double weight);
-
514  UndirectedWeightedEdge(const Edge<T> &edge, const double weight);
- -
516  UndirectedWeightedEdge(const Edge<T> &edge);
- -
518  virtual ~UndirectedWeightedEdge() = default;
-
519  const std::optional<bool> isWeighted() const override;
-
520  //operator
-
521  explicit operator DirectedWeightedEdge<T>() const { return DirectedWeightedEdge<T>(Edge<T>::getId(), Edge<T>::getNodePair(), Weighted::getWeight()); }
-
522 
-
523  friend std::ostream &operator<<<>(std::ostream &os, const UndirectedWeightedEdge<T> &edge);
-
524  };
-
525 
-
526  template <typename T>
-
527  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const unsigned long id, const Node<T> &node1, const Node<T> &node2, const double weight) : UndirectedEdge<T>(id, node1, node2), Weighted(weight)
-
528  {
-
529  }
-
530 
-
531  template <typename T>
-
532  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const unsigned long id, const std::pair<const Node<T> *, const Node<T> *> &nodepair, const double weight) : UndirectedEdge<T>(id, nodepair), Weighted(weight)
-
533  {
-
534  }
-
535 
-
536  template <typename T>
-
537  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const UndirectedEdge<T> &edge, const double weight) : UndirectedEdge<T>(edge), Weighted(weight)
-
538  {
-
539  }
-
540 
-
541  template <typename T>
-
542  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const Edge<T> &edge, const double weight) : UndirectedEdge<T>(edge), Weighted(weight)
-
543  {
-
544  }
-
545 
-
546  template <typename T>
-
547  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const UndirectedEdge<T> &edge) : UndirectedEdge<T>(edge), Weighted()
-
548  {
-
549  }
-
550 
-
551  template <typename T>
-
552  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const Edge<T> &edge) : UndirectedEdge<T>(edge), Weighted()
-
553  {
-
554  }
-
555 
-
556  template <typename T>
-
557  UndirectedWeightedEdge<T>::UndirectedWeightedEdge(const DirectedWeightedEdge<T> &edge) : UndirectedEdge<T>(edge), Weighted(edge.getWeight())
-
558  {
-
559  }
-
560 
-
561  template <typename T>
-
562  const std::optional<bool> UndirectedWeightedEdge<T>::isWeighted() const
-
563  {
-
564  return true;
-
565  }
-
566 
-
567  template <typename T>
-
568  class Partition;
-
569 
-
571  template <typename T>
-
572  class Graph
-
573  {
-
574  private:
-
575  std::list<const Edge<T> *> edgeSet;
-
576  void addElementToAdjMatrix(AdjacencyMatrix<T> &adjMatrix, const Node<T> *nodeFrom, const Node<T> *nodeTo, const Edge<T> *edge) const;
-
577  int writeToStandardFile_csv(const std::string &workingDir, const std::string &OFileName, bool compress, bool writeNodeFeat, bool writeEdgeWeight) const;
-
578  int readFromStandardFile_csv(const std::string &workingDir, const std::string &OFileName, bool compress, bool readNodeFeat, bool readEdgeWeight);
-
579  int writeToStandardFile_tsv(const std::string &workingDir, const std::string &OFileName, bool compress, bool writeNodeFeat, bool writeEdgeWeight) const;
-
580  int readFromStandardFile_tsv(const std::string &workingDir, const std::string &OFileName, bool compress, bool readNodeFeat, bool readEdgeWeight);
-
581  void recreateGraphFromReadFiles(std::map<unsigned long, std::pair<unsigned long, unsigned long>> &edgeMap, std::map<unsigned long, bool> &edgeDirectedMap, std::map<unsigned long, T> &nodeFeatMap, std::map<unsigned long, double> &edgeWeightMap);
-
582  int compressFile(const std::string &inputFile, const std::string &outputFile) const;
-
583  int decompressFile(const std::string &inputFile, const std::string &outputFile) const;
-
584  void greedyPartition(PartitionMap<T> &partitionMap) const;
+
408  if (writeNodeFeat)
+
409  {
+
410  std::ofstream ofileNodeFeat;
+
411  std::string completePathToFileNodeFeat = workingDir + "/" + OFileName + "_NodeFeat"
+
412  ".csv";
+
413  ofileNodeFeat.open(completePathToFileNodeFeat);
+
414  if (!ofileNodeFeat.is_open())
+
415  {
+
416  // ERROR File Not Open
+
417  return -1;
+
418  }
+
419  auto printOutNodeFeat = [&ofileNodeFeat](const Node<T> *node)
+
420  { ofileNodeFeat << node->getId() << "," << node->getData() << std::endl; };
+
421  auto nodeSet = getNodeSet();
+
422  std::for_each(nodeSet.cbegin(), nodeSet.cend(), printOutNodeFeat);
+
423  ofileNodeFeat.close();
+
424  }
+
425 
+
426  if (writeEdgeWeight)
+
427  {
+
428  std::ofstream ofileEdgeWeight;
+
429  std::string completePathToFileEdgeWeight = workingDir + "/" + OFileName + "_EdgeWeight"
+
430  ".csv";
+
431  ofileEdgeWeight.open(completePathToFileEdgeWeight);
+
432  if (!ofileEdgeWeight.is_open())
+
433  {
+
434  // ERROR File Not Open
+
435  return -1;
+
436  }
+
437  auto printOutEdgeWeight = [&ofileEdgeWeight](const Edge<T> *e)
+
438  { ofileEdgeWeight << e->getId() << "," << (e->isWeighted().has_value() && e->isWeighted().value() ? (dynamic_cast<const Weighted *>(e))->getWeight() : 0.0) << "," << (e->isWeighted().has_value() && e->isWeighted().value() ? 1 : 0) << std::endl; };
+
439 
+
440  std::for_each(edgeSet.cbegin(), edgeSet.cend(), printOutEdgeWeight);
+
441  ofileEdgeWeight.close();
+
442  }
+
443  return 0;
+
444  }
+
445 
+
446  template <typename T>
+
447  int Graph<T>::readFromStandardFile_csv(const std::string &workingDir, const std::string &OFileName, bool compress, bool readNodeFeat, bool readEdgeWeight)
+
448  {
+
449  std::ifstream ifileGraph;
+
450  std::ifstream ifileNodeFeat;
+
451  std::ifstream ifileEdgeWeight;
+
452  std::map<unsigned long, std::pair<unsigned long, unsigned long>> edgeMap;
+
453  std::map<unsigned long, bool> edgeDirectedMap;
+
454  std::map<unsigned long, T> nodeFeatMap;
+
455  std::map<unsigned long, double> edgeWeightMap;
+
456  std::string completePathToFileGraph = workingDir + "/" + OFileName + ".csv";
+
457  ifileGraph.open(completePathToFileGraph);
+
458  if (!ifileGraph.is_open())
+
459  {
+
460  // ERROR File Not Open
+
461  return -1;
+
462  }
+
463  char comma;
+
464  for (;;)
+
465  { /* loop continually */
+
466  unsigned long edgeId;
+
467  unsigned long nodeId1;
+
468  unsigned long nodeId2;
+
469  bool directed;
+
470  ifileGraph >> edgeId >> comma >> nodeId1 >> comma >> nodeId2 >> comma >> directed;
+
471  edgeMap[edgeId] = std::pair<unsigned long, unsigned long>(nodeId1, nodeId2);
+
472  edgeDirectedMap[edgeId] = directed;
+
473  if (ifileGraph.fail() || ifileGraph.eof())
+
474  break;
+
475  ifileGraph.ignore(128, '\n');
+
476  }
+
477  ifileGraph.close();
+
478 
+
479  if (readNodeFeat)
+
480  {
+
481  std::string completePathToFileNodeFeat = workingDir + "/" + OFileName + "_NodeFeat"
+
482  ".csv";
+
483  ifileNodeFeat.open(completePathToFileNodeFeat);
+
484  if (!ifileNodeFeat.is_open())
+
485  {
+
486  // ERROR File Not Open
+
487  return -1;
+
488  }
+
489  for (;;)
+
490  { /* loop continually */
+
491  unsigned long nodeId;
+
492  T nodeFeat;
+
493  ifileNodeFeat >> nodeId >> comma >> nodeFeat;
+
494  nodeFeatMap[nodeId] = nodeFeat;
+
495  if (ifileNodeFeat.fail() || ifileNodeFeat.eof())
+
496  break;
+
497  ifileNodeFeat.ignore(128, '\n');
+
498  }
+
499  ifileNodeFeat.close();
+
500  }
+
501 
+
502  if (readEdgeWeight)
+
503  {
+
504  std::string completePathToFileEdgeWeight = workingDir + "/" + OFileName + "_EdgeWeight"
+
505  ".csv";
+
506  ifileEdgeWeight.open(completePathToFileEdgeWeight);
+
507  if (!ifileEdgeWeight.is_open())
+
508  {
+
509  // ERROR File Not Open
+
510  return -1;
+
511  }
+
512  for (;;)
+
513  { /* loop continually */
+
514  unsigned long edgeId;
+
515  double weight;
+
516  bool weighted;
+
517  ifileEdgeWeight >> edgeId >> comma >> weight >> comma >> weighted;
+
518  if (weighted)
+
519  {
+
520  edgeWeightMap[edgeId] = weight;
+
521  }
+
522  if (ifileEdgeWeight.fail() || ifileEdgeWeight.eof())
+
523  break;
+
524  ifileEdgeWeight.ignore(128, '\n');
+
525  }
+
526  ifileEdgeWeight.close();
+
527  }
+
528  recreateGraphFromReadFiles(edgeMap, edgeDirectedMap, nodeFeatMap, edgeWeightMap);
+
529  return 0;
+
530  }
+
531 
+
532  template <typename T>
+
533  int Graph<T>::writeToStandardFile_tsv(const std::string &workingDir, const std::string &OFileName, bool compress, bool writeNodeFeat, bool writeEdgeWeight) const
+
534  {
+
535  std::ofstream ofileGraph;
+
536  std::string completePathToFileGraph = workingDir + "/" + OFileName + ".tsv";
+
537  ofileGraph.open(completePathToFileGraph);
+
538  if (!ofileGraph.is_open())
+
539  {
+
540  // ERROR File Not Open
+
541  return -1;
+
542  }
+
543  auto printOutGraph = [&ofileGraph](const Edge<T> *e)
+
544  { ofileGraph << e->getId() << "\t" << e->getNodePair().first->getId() << "\t" << e->getNodePair().second->getId() << "\t" << ((e->isDirected().has_value() && e->isDirected().value()) ? 1 : 0) << std::endl; };
+
545  std::for_each(edgeSet.cbegin(), edgeSet.cend(), printOutGraph);
+
546  ofileGraph.close();
+
547 
+
548  if (writeNodeFeat)
+
549  {
+
550  std::ofstream ofileNodeFeat;
+
551  std::string completePathToFileNodeFeat = workingDir + "/" + OFileName + "_NodeFeat"
+
552  ".tsv";
+
553  ofileNodeFeat.open(completePathToFileNodeFeat);
+
554  if (!ofileNodeFeat.is_open())
+
555  {
+
556  // ERROR File Not Open
+
557  return -1;
+
558  }
+
559  auto printOutNodeFeat = [&ofileNodeFeat](const Node<T> *node)
+
560  { ofileNodeFeat << node->getId() << "\t" << node->getData() << std::endl; };
+
561  auto nodeSet = getNodeSet();
+
562  std::for_each(nodeSet.cbegin(), nodeSet.cend(), printOutNodeFeat);
+
563  ofileNodeFeat.close();
+
564  }
+
565 
+
566  if (writeEdgeWeight)
+
567  {
+
568  std::ofstream ofileEdgeWeight;
+
569  std::string completePathToFileEdgeWeight = workingDir + "/" + OFileName + "_EdgeWeight"
+
570  ".tsv";
+
571  ofileEdgeWeight.open(completePathToFileEdgeWeight);
+
572  if (!ofileEdgeWeight.is_open())
+
573  {
+
574  // ERROR File Not Open
+
575  return -1;
+
576  }
+
577  auto printOutEdgeWeight = [&ofileEdgeWeight](const Edge<T> *e)
+
578  { ofileEdgeWeight << e->getId() << "\t" << (e->isWeighted().has_value() && e->isWeighted().value() ? (dynamic_cast<const Weighted *>(e))->getWeight() : 0.0) << "\t" << (e->isWeighted().has_value() && e->isWeighted().value() ? 1 : 0) << std::endl; };
+
579 
+
580  std::for_each(edgeSet.cbegin(), edgeSet.cend(), printOutEdgeWeight);
+
581  ofileEdgeWeight.close();
+
582  }
+
583  return 0;
+
584  }
585 
-
586  public:
- -
589  {
- - -
592  OUT_1,
-
593  OUT_2
-
594  };
-
595 
-
596  typedef E_InputOutputFormat InputOutputFormat;
-
597 
- -
600  {
- -
602  ALG_1,
-
603  ALG_2
-
604  };
-
605  typedef E_PartitionAlgorithm PartitionAlgorithm;
-
606 
-
607  Graph() = default;
-
608  Graph(const std::list<const Edge<T> *> &edgeSet);
-
609  ~Graph() = default;
-
618  virtual const std::list<const Edge<T> *> &getEdgeSet() const;
-
627  virtual void setEdgeSet(std::list<const Edge<T> *> &edgeSet);
-
636  virtual void addEdge(const Edge<T> *edge);
-
645  virtual void removeEdge(unsigned long edgeId);
-
654  virtual const std::list<const Node<T> *> getNodeSet() const;
-
664  virtual const std::optional<const Edge<T> *> getEdge(unsigned long edgeId) const;
-
670  virtual const AdjacencyMatrix<T> getAdjMatrix() const;
-
683  virtual const DijkstraResult dijkstra(const Node<T> &source, const Node<T> &target) const;
-
694  virtual const std::vector<Node<T>> breadth_first_search(const Node<T> &start) const;
-
705  virtual const std::vector<Node<T>> depth_first_search(const Node<T> &start) const;
-
706 
-
715  virtual bool isCyclicDirectedGraphDFS() const;
-
716 
-
725  virtual bool isCyclicDirectedGraphBFS() const;
-
726 
-
734  virtual bool isDirectedGraph() const;
-
735 
-
762  virtual const DialResult dial(const Node<T> &source, int maxWeight) const;
+
586  template <typename T>
+
587  int Graph<T>::readFromStandardFile_tsv(const std::string &workingDir, const std::string &OFileName, bool compress, bool readNodeFeat, bool readEdgeWeight)
+
588  {
+
589  std::ifstream ifileGraph;
+
590  std::ifstream ifileNodeFeat;
+
591  std::ifstream ifileEdgeWeight;
+
592  std::map<unsigned long, std::pair<unsigned long, unsigned long>> edgeMap;
+
593  std::map<unsigned long, bool> edgeDirectedMap;
+
594  std::map<unsigned long, T> nodeFeatMap;
+
595  std::map<unsigned long, double> edgeWeightMap;
+
596  std::string completePathToFileGraph = workingDir + "/" + OFileName + ".tsv";
+
597  ifileGraph.open(completePathToFileGraph);
+
598  if (!ifileGraph.is_open())
+
599  {
+
600  // ERROR File Not Open
+
601  return -1;
+
602  }
+
603  for (;;)
+
604  { /* loop continually */
+
605  unsigned long edgeId;
+
606  unsigned long nodeId1;
+
607  unsigned long nodeId2;
+
608  bool directed;
+
609  ifileGraph >> edgeId >> std::ws >> nodeId1 >> std::ws >> nodeId2 >> std::ws >> directed;
+
610  edgeMap[edgeId] = std::pair<unsigned long, unsigned long>(nodeId1, nodeId2);
+
611  edgeDirectedMap[edgeId] = directed;
+
612  if (ifileGraph.fail() || ifileGraph.eof())
+
613  break;
+
614  ifileGraph.ignore(128, '\n');
+
615  }
+
616  ifileGraph.close();
+
617 
+
618  if (readNodeFeat)
+
619  {
+
620  std::string completePathToFileNodeFeat = workingDir + "/" + OFileName + "_NodeFeat"
+
621  ".tsv";
+
622  ifileNodeFeat.open(completePathToFileNodeFeat);
+
623  if (!ifileNodeFeat.is_open())
+
624  {
+
625  // ERROR File Not Open
+
626  return -1;
+
627  }
+
628  for (;;)
+
629  { /* loop continually */
+
630  unsigned long nodeId;
+
631  T nodeFeat;
+
632  ifileNodeFeat >> nodeId >> std::ws >> nodeFeat;
+
633  nodeFeatMap[nodeId] = nodeFeat;
+
634  if (ifileNodeFeat.fail() || ifileNodeFeat.eof())
+
635  break;
+
636  ifileNodeFeat.ignore(128, '\n');
+
637  }
+
638  ifileNodeFeat.close();
+
639  }
+
640 
+
641  if (readEdgeWeight)
+
642  {
+
643  std::string completePathToFileEdgeWeight = workingDir + "/" + OFileName + "_EdgeWeight"
+
644  ".tsv";
+
645  ifileEdgeWeight.open(completePathToFileEdgeWeight);
+
646  if (!ifileEdgeWeight.is_open())
+
647  {
+
648  // ERROR File Not Open
+
649  return -1;
+
650  }
+
651  for (;;)
+
652  { /* loop continually */
+
653  unsigned long edgeId;
+
654  double weight;
+
655  bool weighted;
+
656  ifileEdgeWeight >> edgeId >> std::ws >> weight >> std::ws >> weighted;
+
657  if (weighted)
+
658  {
+
659  edgeWeightMap[edgeId] = weight;
+
660  }
+
661  if (ifileEdgeWeight.fail() || ifileEdgeWeight.eof())
+
662  break;
+
663  ifileEdgeWeight.ignore(128, '\n');
+
664  }
+
665  ifileEdgeWeight.close();
+
666  }
+
667  recreateGraphFromReadFiles(edgeMap, edgeDirectedMap, nodeFeatMap, edgeWeightMap);
+
668  return 0;
+
669  }
+
670 
+
671  template <typename T>
+
672  void Graph<T>::recreateGraphFromReadFiles(std::map<unsigned long, std::pair<unsigned long, unsigned long>> &edgeMap, std::map<unsigned long, bool> &edgeDirectedMap, std::map<unsigned long, T> &nodeFeatMap, std::map<unsigned long, double> &edgeWeightMap)
+
673  {
+
674  std::map<unsigned long, Node<T> *> nodeMap;
+
675  for (auto edgeIt = edgeMap.begin(); edgeIt != edgeMap.end(); ++edgeIt)
+
676  {
+
677  Node<T> *node1 = nullptr;
+
678  Node<T> *node2 = nullptr;
+
679  if (nodeMap.find(edgeIt->second.first) == nodeMap.end())
+
680  {
+
681  //Create new Node
+
682  T feat;
+
683  if (nodeFeatMap.find(edgeIt->second.first) != nodeFeatMap.end())
+
684  {
+
685  feat = nodeFeatMap.at(edgeIt->second.first);
+
686  }
+
687  node1 = new Node<T>(edgeIt->second.first, feat);
+
688  nodeMap[edgeIt->second.first] = node1;
+
689  }
+
690  else
+
691  {
+
692  node1 = nodeMap.at(edgeIt->second.first);
+
693  }
+
694  if (nodeMap.find(edgeIt->second.second) == nodeMap.end())
+
695  {
+
696  //Create new Node
+
697  T feat;
+
698  if (nodeFeatMap.find(edgeIt->second.second) != nodeFeatMap.end())
+
699  {
+
700  feat = nodeFeatMap.at(edgeIt->second.second);
+
701  }
+
702  node2 = new Node<T>(edgeIt->second.second, feat);
+
703  nodeMap[edgeIt->second.second] = node2;
+
704  }
+
705  else
+
706  {
+
707  node2 = nodeMap.at(edgeIt->second.second);
+
708  }
+
709 
+
710  if (edgeWeightMap.find(edgeIt->first) != edgeWeightMap.end())
+
711  {
+
712  if (edgeDirectedMap.find(edgeIt->first) != edgeDirectedMap.end() && edgeDirectedMap.at(edgeIt->first))
+
713  {
+
714  auto edge = new DirectedWeightedEdge<T>(edgeIt->first, *node1, *node2, edgeWeightMap.at(edgeIt->first));
+
715  addEdge(edge);
+
716  }
+
717  else
+
718  {
+
719  auto edge = new UndirectedWeightedEdge<T>(edgeIt->first, *node1, *node2, edgeWeightMap.at(edgeIt->first));
+
720  addEdge(edge);
+
721  }
+
722  }
+
723  else
+
724  {
+
725  if (edgeDirectedMap.find(edgeIt->first) != edgeDirectedMap.end() && edgeDirectedMap.at(edgeIt->first))
+
726  {
+
727  auto edge = new DirectedEdge<T>(edgeIt->first, *node1, *node2);
+
728  addEdge(edge);
+
729  }
+
730  else
+
731  {
+
732  auto edge = new UndirectedEdge<T>(edgeIt->first, *node1, *node2);
+
733  addEdge(edge);
+
734  }
+
735  }
+
736  }
+
737  }
+
738 
+
739  template <typename T>
+
740  int Graph<T>::compressFile(const std::string &inputFile, const std::string &outputFile) const
+
741  {
+
742 
+
743  std::ifstream ifs;
+
744  ifs.open(inputFile);
+
745  if (!ifs.is_open())
+
746  {
+
747  // ERROR File Not Open
+
748  return -1;
+
749  }
+
750  std::string content((std::istreambuf_iterator<char>(ifs)),
+
751  (std::istreambuf_iterator<char>()));
+
752 
+
753  const char *content_ptr = content.c_str();
+
754  gzFile outFileZ = gzopen(outputFile.c_str(), "wb");
+
755  if (outFileZ == NULL)
+
756  {
+
757  //printf("Error: Failed to gzopen %s\n", outputFile.c_str());
+
758  return -1;
+
759  }
+
760 
+
761  unsigned int zippedBytes;
+
762  zippedBytes = gzwrite(outFileZ, content_ptr, strlen(content_ptr));
763 
-
777  virtual int writeToFile(InputOutputFormat format = InputOutputFormat::STANDARD_CSV, const std::string &workingDir = ".", const std::string &OFileName = "graph", bool compress = false, bool writeNodeFeat = false, bool writeEdgeWeight = false) const;
-
778 
-
792  virtual int readFromFile(InputOutputFormat format = InputOutputFormat::STANDARD_CSV, const std::string &workingDir = ".", const std::string &OFileName = "graph", bool compress = false, bool readNodeFeat = false, bool readEdgeWeight = false);
-
793 
-
803  virtual PartitionMap<T> partitionGraph(PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const;
-
804 
-
805  friend std::ostream &operator<<<>(std::ostream &os, const Graph<T> &graph);
-
806  friend std::ostream &operator<<<>(std::ostream &os, const AdjacencyMatrix<T> &adj);
-
807  };
-
808 
-
809  template <typename T>
-
810  Graph<T>::Graph(const std::list<const Edge<T> *> &edgeSet)
-
811  {
-
812  for (auto edgeSetIt = edgeSet.begin(); edgeSetIt != edgeSet.end(); ++edgeSetIt)
-
813  {
-
814  if (std::find_if(this->edgeSet.begin(), this->edgeSet.end(), [edgeSetIt](const Edge<T> *edge)
-
815  { return (*edge == **edgeSetIt); }) == this->edgeSet.end())
-
816  {
-
817  this->edgeSet.push_back(*edgeSetIt);
-
818  }
-
819  }
-
820  }
-
821 
-
822  template <typename T>
-
823  const std::list<const Edge<T> *> &Graph<T>::getEdgeSet() const
-
824  {
-
825  return edgeSet;
-
826  }
-
827 
-
828  template <typename T>
-
829  void Graph<T>::setEdgeSet(std::list<const Edge<T> *> &edgeSet)
-
830  {
-
831  this->edgeSet.clear();
-
832  for (auto edgeSetIt = edgeSet.begin(); edgeSetIt != edgeSet.end(); ++edgeSetIt)
-
833  {
-
834  if (std::find_if(this->edgeSet.begin(), this->edgeSet.end(), [edgeSetIt](const Edge<T> *edge)
-
835  { return (*edge == **edgeSetIt); }) == this->edgeSet.end())
-
836  {
-
837  this->edgeSet.push_back(*edgeSetIt);
-
838  }
-
839  }
-
840  }
-
841 
-
842  template <typename T>
-
843  void Graph<T>::addEdge(const Edge<T> *edge)
-
844  {
-
845  if (std::find_if(edgeSet.begin(), edgeSet.end(), [edge](const Edge<T> *edge_a)
-
846  { return (*edge == *edge_a); }) == edgeSet.end())
-
847  {
-
848  edgeSet.push_back(edge);
-
849  }
-
850  }
-
851 
-
852  template <typename T>
-
853  void Graph<T>::removeEdge(unsigned long edgeId)
-
854  {
-
855  auto edgeOpt = Graph<T>::getEdge(edgeId);
-
856  if (edgeOpt.has_value())
-
857  {
-
858  edgeSet.erase(std::find_if(this->edgeSet.begin(), this->edgeSet.end(), [edgeOpt](const Edge<T> *edge)
-
859  { return (*(edgeOpt.value()) == *edge); }));
-
860  }
-
861  }
-
862 
-
863  template <typename T>
-
864  const std::list<const Node<T> *> Graph<T>::getNodeSet() const
-
865  {
-
866  std::list<const Node<T> *> nodeSet;
-
867  for (auto edge : edgeSet)
-
868  {
-
869  if (std::find_if(nodeSet.begin(), nodeSet.end(), [edge](const Node<T> *node)
-
870  { return (*edge->getNodePair().first == *node); }) == nodeSet.end())
-
871  {
-
872  nodeSet.push_back(edge->getNodePair().first);
-
873  }
-
874  if (std::find_if(nodeSet.begin(), nodeSet.end(), [edge](const Node<T> *node)
-
875  { return (*edge->getNodePair().second == *node); }) == nodeSet.end())
-
876  {
-
877  nodeSet.push_back(edge->getNodePair().second);
-
878  }
-
879  }
-
880  return nodeSet;
-
881  }
-
882 
-
883  template <typename T>
-
884  const std::optional<const Edge<T> *> Graph<T>::getEdge(unsigned long edgeId) const
-
885  {
-
886 
-
887  auto it = edgeSet.begin();
-
888  for (it; it != edgeSet.end(); ++it)
-
889  {
-
890  if ((*it)->getId() == edgeId)
-
891  {
-
892  return *it;
-
893  }
-
894  }
-
895 
-
896  return std::nullopt;
-
897  }
-
898 
-
899  template <typename T>
-
900  void Graph<T>::addElementToAdjMatrix(AdjacencyMatrix<T> &adjMatrix, const Node<T> *nodeFrom, const Node<T> *nodeTo, const Edge<T> *edge) const
-
901  {
-
902  std::pair<const Node<T> *, const Edge<T> *> elem = {nodeTo, edge};
-
903  adjMatrix[nodeFrom].push_back(elem);
-
904 
-
905  //adjMatrix[nodeFrom.getId()].push_back(std::make_pair<const Node<T>,const Edge<T>>(nodeTo, edge));
-
906  }
-
907 
-
908  template <typename T>
-
909  int Graph<T>::writeToStandardFile_csv(const std::string &workingDir, const std::string &OFileName, bool compress, bool writeNodeFeat, bool writeEdgeWeight) const
-
910  {
-
911  std::ofstream ofileGraph;
-
912  std::string completePathToFileGraph = workingDir + "/" + OFileName + ".csv";
-
913  ofileGraph.open(completePathToFileGraph);
-
914  if (!ofileGraph.is_open())
-
915  {
-
916  // ERROR File Not Open
-
917  return -1;
-
918  }
-
919  auto printOutGraph = [&ofileGraph](const Edge<T> *e)
-
920  { ofileGraph << e->getId() << "," << e->getNodePair().first->getId() << "," << e->getNodePair().second->getId() << "," << ((e->isDirected().has_value() && e->isDirected().value()) ? 1 : 0) << std::endl; };
-
921  std::for_each(edgeSet.cbegin(), edgeSet.cend(), printOutGraph);
-
922  ofileGraph.close();
-
923 
-
924  if (writeNodeFeat)
-
925  {
-
926  std::ofstream ofileNodeFeat;
-
927  std::string completePathToFileNodeFeat = workingDir + "/" + OFileName + "_NodeFeat"
-
928  ".csv";
-
929  ofileNodeFeat.open(completePathToFileNodeFeat);
-
930  if (!ofileNodeFeat.is_open())
-
931  {
-
932  // ERROR File Not Open
-
933  return -1;
-
934  }
-
935  auto printOutNodeFeat = [&ofileNodeFeat](const Node<T> *node)
-
936  { ofileNodeFeat << node->getId() << "," << node->getData() << std::endl; };
-
937  auto nodeSet = getNodeSet();
-
938  std::for_each(nodeSet.cbegin(), nodeSet.cend(), printOutNodeFeat);
-
939  ofileNodeFeat.close();
-
940  }
-
941 
-
942  if (writeEdgeWeight)
-
943  {
-
944  std::ofstream ofileEdgeWeight;
-
945  std::string completePathToFileEdgeWeight = workingDir + "/" + OFileName + "_EdgeWeight"
-
946  ".csv";
-
947  ofileEdgeWeight.open(completePathToFileEdgeWeight);
-
948  if (!ofileEdgeWeight.is_open())
-
949  {
-
950  // ERROR File Not Open
-
951  return -1;
-
952  }
-
953  auto printOutEdgeWeight = [&ofileEdgeWeight](const Edge<T> *e)
-
954  { ofileEdgeWeight << e->getId() << "," << (e->isWeighted().has_value() && e->isWeighted().value() ? (dynamic_cast<const Weighted *>(e))->getWeight() : 0.0) << "," << (e->isWeighted().has_value() && e->isWeighted().value() ? 1 : 0) << std::endl; };
-
955 
-
956  std::for_each(edgeSet.cbegin(), edgeSet.cend(), printOutEdgeWeight);
-
957  ofileEdgeWeight.close();
-
958  }
-
959  return 0;
-
960  }
-
961 
-
962  template <typename T>
-
963  int Graph<T>::readFromStandardFile_csv(const std::string &workingDir, const std::string &OFileName, bool compress, bool readNodeFeat, bool readEdgeWeight)
-
964  {
-
965  std::ifstream ifileGraph;
-
966  std::ifstream ifileNodeFeat;
-
967  std::ifstream ifileEdgeWeight;
-
968  std::map<unsigned long, std::pair<unsigned long, unsigned long>> edgeMap;
-
969  std::map<unsigned long, bool> edgeDirectedMap;
-
970  std::map<unsigned long, T> nodeFeatMap;
-
971  std::map<unsigned long, double> edgeWeightMap;
-
972  std::string completePathToFileGraph = workingDir + "/" + OFileName + ".csv";
-
973  ifileGraph.open(completePathToFileGraph);
-
974  if (!ifileGraph.is_open())
-
975  {
-
976  // ERROR File Not Open
-
977  return -1;
-
978  }
-
979  char comma;
-
980  for (;;)
-
981  { /* loop continually */
-
982  unsigned long edgeId;
-
983  unsigned long nodeId1;
-
984  unsigned long nodeId2;
-
985  bool directed;
-
986  ifileGraph >> edgeId >> comma >> nodeId1 >> comma >> nodeId2 >> comma >> directed;
-
987  edgeMap[edgeId] = std::pair<unsigned long, unsigned long>(nodeId1, nodeId2);
-
988  edgeDirectedMap[edgeId] = directed;
-
989  if (ifileGraph.fail() || ifileGraph.eof())
-
990  break;
-
991  ifileGraph.ignore(128, '\n');
-
992  }
-
993  ifileGraph.close();
-
994 
-
995  if (readNodeFeat)
-
996  {
-
997  std::string completePathToFileNodeFeat = workingDir + "/" + OFileName + "_NodeFeat"
-
998  ".csv";
-
999  ifileNodeFeat.open(completePathToFileNodeFeat);
-
1000  if (!ifileNodeFeat.is_open())
-
1001  {
-
1002  // ERROR File Not Open
-
1003  return -1;
-
1004  }
-
1005  for (;;)
-
1006  { /* loop continually */
-
1007  unsigned long nodeId;
-
1008  T nodeFeat;
-
1009  ifileNodeFeat >> nodeId >> comma >> nodeFeat;
-
1010  nodeFeatMap[nodeId] = nodeFeat;
-
1011  if (ifileNodeFeat.fail() || ifileNodeFeat.eof())
-
1012  break;
-
1013  ifileNodeFeat.ignore(128, '\n');
-
1014  }
-
1015  ifileNodeFeat.close();
-
1016  }
-
1017 
-
1018  if (readEdgeWeight)
-
1019  {
-
1020  std::string completePathToFileEdgeWeight = workingDir + "/" + OFileName + "_EdgeWeight"
-
1021  ".csv";
-
1022  ifileEdgeWeight.open(completePathToFileEdgeWeight);
-
1023  if (!ifileEdgeWeight.is_open())
-
1024  {
-
1025  // ERROR File Not Open
-
1026  return -1;
-
1027  }
-
1028  for (;;)
-
1029  { /* loop continually */
-
1030  unsigned long edgeId;
-
1031  double weight;
-
1032  bool weighted;
-
1033  ifileEdgeWeight >> edgeId >> comma >> weight >> comma >> weighted;
-
1034  if (weighted)
-
1035  {
-
1036  edgeWeightMap[edgeId] = weight;
-
1037  }
-
1038  if (ifileEdgeWeight.fail() || ifileEdgeWeight.eof())
-
1039  break;
-
1040  ifileEdgeWeight.ignore(128, '\n');
-
1041  }
-
1042  ifileEdgeWeight.close();
-
1043  }
-
1044  recreateGraphFromReadFiles(edgeMap, edgeDirectedMap, nodeFeatMap, edgeWeightMap);
-
1045  return 0;
-
1046  }
-
1047 
-
1048  template <typename T>
-
1049  int Graph<T>::writeToStandardFile_tsv(const std::string &workingDir, const std::string &OFileName, bool compress, bool writeNodeFeat, bool writeEdgeWeight) const
-
1050  {
-
1051  std::ofstream ofileGraph;
-
1052  std::string completePathToFileGraph = workingDir + "/" + OFileName + ".tsv";
-
1053  ofileGraph.open(completePathToFileGraph);
-
1054  if (!ofileGraph.is_open())
-
1055  {
-
1056  // ERROR File Not Open
-
1057  return -1;
-
1058  }
-
1059  auto printOutGraph = [&ofileGraph](const Edge<T> *e)
-
1060  { ofileGraph << e->getId() << "\t" << e->getNodePair().first->getId() << "\t" << e->getNodePair().second->getId() << "\t" << ((e->isDirected().has_value() && e->isDirected().value()) ? 1 : 0) << std::endl; };
-
1061  std::for_each(edgeSet.cbegin(), edgeSet.cend(), printOutGraph);
-
1062  ofileGraph.close();
-
1063 
-
1064  if (writeNodeFeat)
-
1065  {
-
1066  std::ofstream ofileNodeFeat;
-
1067  std::string completePathToFileNodeFeat = workingDir + "/" + OFileName + "_NodeFeat"
-
1068  ".tsv";
-
1069  ofileNodeFeat.open(completePathToFileNodeFeat);
-
1070  if (!ofileNodeFeat.is_open())
-
1071  {
-
1072  // ERROR File Not Open
-
1073  return -1;
-
1074  }
-
1075  auto printOutNodeFeat = [&ofileNodeFeat](const Node<T> *node)
-
1076  { ofileNodeFeat << node->getId() << "\t" << node->getData() << std::endl; };
-
1077  auto nodeSet = getNodeSet();
-
1078  std::for_each(nodeSet.cbegin(), nodeSet.cend(), printOutNodeFeat);
-
1079  ofileNodeFeat.close();
-
1080  }
-
1081 
-
1082  if (writeEdgeWeight)
-
1083  {
-
1084  std::ofstream ofileEdgeWeight;
-
1085  std::string completePathToFileEdgeWeight = workingDir + "/" + OFileName + "_EdgeWeight"
-
1086  ".tsv";
-
1087  ofileEdgeWeight.open(completePathToFileEdgeWeight);
-
1088  if (!ofileEdgeWeight.is_open())
-
1089  {
-
1090  // ERROR File Not Open
-
1091  return -1;
-
1092  }
-
1093  auto printOutEdgeWeight = [&ofileEdgeWeight](const Edge<T> *e)
-
1094  { ofileEdgeWeight << e->getId() << "\t" << (e->isWeighted().has_value() && e->isWeighted().value() ? (dynamic_cast<const Weighted *>(e))->getWeight() : 0.0) << "\t" << (e->isWeighted().has_value() && e->isWeighted().value() ? 1 : 0) << std::endl; };
-
1095 
-
1096  std::for_each(edgeSet.cbegin(), edgeSet.cend(), printOutEdgeWeight);
-
1097  ofileEdgeWeight.close();
-
1098  }
-
1099  return 0;
-
1100  }
-
1101 
-
1102  template <typename T>
-
1103  int Graph<T>::readFromStandardFile_tsv(const std::string &workingDir, const std::string &OFileName, bool compress, bool readNodeFeat, bool readEdgeWeight)
-
1104  {
-
1105  std::ifstream ifileGraph;
-
1106  std::ifstream ifileNodeFeat;
-
1107  std::ifstream ifileEdgeWeight;
-
1108  std::map<unsigned long, std::pair<unsigned long, unsigned long>> edgeMap;
-
1109  std::map<unsigned long, bool> edgeDirectedMap;
-
1110  std::map<unsigned long, T> nodeFeatMap;
-
1111  std::map<unsigned long, double> edgeWeightMap;
-
1112  std::string completePathToFileGraph = workingDir + "/" + OFileName + ".tsv";
-
1113  ifileGraph.open(completePathToFileGraph);
-
1114  if (!ifileGraph.is_open())
-
1115  {
-
1116  // ERROR File Not Open
-
1117  return -1;
-
1118  }
-
1119  for (;;)
-
1120  { /* loop continually */
-
1121  unsigned long edgeId;
-
1122  unsigned long nodeId1;
-
1123  unsigned long nodeId2;
-
1124  bool directed;
-
1125  ifileGraph >> edgeId >> std::ws >> nodeId1 >> std::ws >> nodeId2 >> std::ws >> directed;
-
1126  edgeMap[edgeId] = std::pair<unsigned long, unsigned long>(nodeId1, nodeId2);
-
1127  edgeDirectedMap[edgeId] = directed;
-
1128  if (ifileGraph.fail() || ifileGraph.eof())
-
1129  break;
-
1130  ifileGraph.ignore(128, '\n');
-
1131  }
-
1132  ifileGraph.close();
+
764  ifs.close();
+
765  gzclose(outFileZ);
+
766  return 0;
+
767  }
+
768 
+
769  template <typename T>
+
770  int Graph<T>::decompressFile(const std::string &inputFile, const std::string &outputFile) const
+
771  {
+
772 
+
773  gzFile inFileZ = gzopen(inputFile.c_str(), "rb");
+
774  if (inFileZ == NULL)
+
775  {
+
776  //printf("Error: Failed to gzopen %s\n", inputFile.c_str());
+
777  return -1;
+
778  }
+
779  unsigned char unzipBuffer[8192];
+
780  unsigned int unzippedBytes;
+
781  std::vector<unsigned char> unzippedData;
+
782  std::ofstream ofs;
+
783  ofs.open(outputFile);
+
784  if (!ofs.is_open())
+
785  {
+
786  // ERROR File Not Open
+
787  return -1;
+
788  }
+
789  while (true)
+
790  {
+
791  unzippedBytes = gzread(inFileZ, unzipBuffer, 8192);
+
792  if (unzippedBytes > 0)
+
793  {
+
794  unzippedData.insert(unzippedData.end(), unzipBuffer, unzipBuffer + unzippedBytes);
+
795  }
+
796  else
+
797  {
+
798  break;
+
799  }
+
800  }
+
801  for (auto c : unzippedData)
+
802  {
+
803  ofs << c;
+
804  }
+
805  ofs << std::endl;
+
806  ofs.close();
+
807  gzclose(inFileZ);
+
808  return 0;
+
809  }
+
810 
+
811  template <typename T>
+
812  void Graph<T>::greedyPartition(PartitionMap<T> &partitionMap) const
+
813  {
+
814  unsigned int index = 0;
+
815  unsigned int numberOfPartitions = partitionMap.size();
+
816  if (index == numberOfPartitions)
+
817  {
+
818  //ERROR partition map of zero element
+
819  return;
+
820  }
+
821  auto edgeSet = getEdgeSet();
+
822  for (auto edge : edgeSet)
+
823  {
+
824  partitionMap.at(index)->addEdge(edge);
+
825  index++;
+
826  index = index % numberOfPartitions;
+
827  }
+
828  }
+
829 
+
830  template <typename T>
+
831  void Graph<T>::HDRFPartition(PartitionMap<T> &partitionMap) const
+
832  {
+
833  }
+
834 
+
835  template <typename T>
+
836  const AdjacencyMatrix<T> Graph<T>::getAdjMatrix() const
+
837  {
+
838  AdjacencyMatrix<T> adj;
+
839  auto edgeSetIt = edgeSet.begin();
+
840  for (edgeSetIt; edgeSetIt != edgeSet.end(); ++edgeSetIt)
+
841  {
+
842  if ((*edgeSetIt)->isDirected().has_value() && (*edgeSetIt)->isDirected().value())
+
843  {
+
844  const DirectedEdge<T> *d_edge = dynamic_cast<const DirectedEdge<T> *>(*edgeSetIt);
+
845  addElementToAdjMatrix(adj, &(d_edge->getFrom()), &(d_edge->getTo()), d_edge);
+
846  }
+
847  else if ((*edgeSetIt)->isDirected().has_value() && !(*edgeSetIt)->isDirected().value())
+
848  {
+
849  const UndirectedEdge<T> *ud_edge = dynamic_cast<const UndirectedEdge<T> *>(*edgeSetIt);
+
850  ;
+
851  addElementToAdjMatrix(adj, &(ud_edge->getNode1()), &(ud_edge->getNode2()), ud_edge);
+
852  addElementToAdjMatrix(adj, &(ud_edge->getNode2()), &(ud_edge->getNode1()), ud_edge);
+
853  }
+
854  else
+
855  { //is a simple edge we cannot create adj matrix
+
856  return adj;
+
857  }
+
858  }
+
859  return adj;
+
860  }
+
861 
+
862  template <typename T>
+
863  const DijkstraResult Graph<T>::dijkstra(const Node<T> &source, const Node<T> &target) const
+
864  {
+
865  DijkstraResult result;
+
866  result.success = false;
+
867  result.errorMessage = "";
+
868  result.result = INF_DOUBLE;
+
869  auto nodeSet = getNodeSet();
+
870  if (std::find(nodeSet.begin(), nodeSet.end(), &source) == nodeSet.end())
+
871  {
+
872  // check if source node exist in the graph
+
873  result.errorMessage = ERR_SOURCE_NODE_NOT_IN_GRAPH;
+
874  return result;
+
875  }
+
876  if (std::find(nodeSet.begin(), nodeSet.end(), &target) == nodeSet.end())
+
877  {
+
878  // check if target node exist in the graph
+
879  result.errorMessage = ERR_TARGET_NODE_NOT_IN_GRAPH;
+
880  return result;
+
881  }
+
882  const AdjacencyMatrix<T> adj = getAdjMatrix();
+
883  // n denotes the number of vertices in graph
+
884  int n = adj.size();
+
885 
+
886  // setting all the distances initially to INF_DOUBLE
+
887  std::map<const Node<T> *, double> dist;
+
888 
+
889  for (auto elem : adj)
+
890  {
+
891  dist[elem.first] = INF_DOUBLE;
+
892  }
+
893 
+
894  // creating a min heap using priority queue
+
895  // first element of pair contains the distance
+
896  // second element of pair contains the vertex
+
897  std::priority_queue<std::pair<double, const Node<T> *>, std::vector<std::pair<double, const Node<T> *>>,
+
898  std::greater<std::pair<double, const Node<T> *>>>
+
899  pq;
+
900 
+
901  // pushing the source vertex 's' with 0 distance in min heap
+
902  pq.push(std::make_pair(0.0, &source));
+
903 
+
904  // marking the distance of source as 0
+
905  dist[&source] = 0;
+
906 
+
907  while (!pq.empty())
+
908  {
+
909  // second element of pair denotes the node / vertex
+
910  const Node<T> *currentNode = pq.top().second;
+
911 
+
912  // first element of pair denotes the distance
+
913  double currentDist = pq.top().first;
+
914 
+
915  pq.pop();
+
916 
+
917  // for all the reachable vertex from the currently exploring vertex
+
918  // we will try to minimize the distance
+
919  if (adj.find(currentNode) != adj.end())
+
920  {
+
921  for (std::pair<const Node<T> *, const Edge<T> *> elem : adj.at(currentNode))
+
922  {
+
923  // minimizing distances
+
924  if (elem.second->isWeighted().has_value() && elem.second->isWeighted().value())
+
925  {
+
926  if (elem.second->isDirected().has_value() && elem.second->isDirected().value())
+
927  {
+
928  const DirectedWeightedEdge<T> *dw_edge = dynamic_cast<const DirectedWeightedEdge<T> *>(elem.second);
+
929  if (currentDist + dw_edge->getWeight() < dist[elem.first])
+
930  {
+
931  dist[elem.first] = currentDist + dw_edge->getWeight();
+
932  pq.push(std::make_pair(dist[elem.first], elem.first));
+
933  }
+
934  }
+
935  else if (elem.second->isDirected().has_value() && !elem.second->isDirected().value())
+
936  {
+
937  const UndirectedWeightedEdge<T> *udw_edge = dynamic_cast<const UndirectedWeightedEdge<T> *>(elem.second);
+
938  if (currentDist + udw_edge->getWeight() < dist[elem.first])
+
939  {
+
940  dist[elem.first] = currentDist + udw_edge->getWeight();
+
941  pq.push(std::make_pair(dist[elem.first], elem.first));
+
942  }
+
943  }
+
944  else
+
945  {
+
946  //ERROR it shouldn't never returned ( does not exist a Node Weighted and not Directed/Undirected)
+
947  result.errorMessage = ERR_NO_DIR_OR_UNDIR_EDGE;
+
948  return result;
+
949  }
+
950  }
+
951  else
+
952  {
+
953  // No Weighted Edge
+
954  result.errorMessage = ERR_NO_WEIGHTED_EDGE;
+
955  return result;
+
956  }
+
957  }
+
958  }
+
959  }
+
960  if (dist[&target] != INF_DOUBLE)
+
961  {
+
962  result.success = true;
+
963  result.errorMessage = "";
+
964  result.result = dist[&target];
+
965  return result;
+
966  }
+
967  result.errorMessage = ERR_TARGET_NODE_NOT_REACHABLE;
+
968  result.result = -1;
+
969  return result;
+
970  }
+
971 
+
972  template <typename T>
+
973  const std::vector<Node<T>> Graph<T>::breadth_first_search(const Node<T> &start) const
+
974  {
+
975  // vector to keep track of visited nodes
+
976  std::vector<Node<T>> visited;
+
977  auto nodeSet = getNodeSet();
+
978  //check is exist node in the graph
+
979  if (std::find(nodeSet.begin(), nodeSet.end(), &start) == nodeSet.end())
+
980  {
+
981  return visited;
+
982  }
+
983  const AdjacencyMatrix<T> adj = getAdjMatrix();
+
984  // queue that stores vertices that need to be further explored
+
985  std::queue<const Node<T> *> tracker;
+
986 
+
987  // mark the starting node as visited
+
988  visited.push_back(start);
+
989  tracker.push(&start);
+
990  while (!tracker.empty())
+
991  {
+
992  const Node<T> *node = tracker.front();
+
993  tracker.pop();
+
994  if (adj.find(node) != adj.end())
+
995  {
+
996  for (auto elem : adj.at(node))
+
997  {
+
998  // if the node is not visited then mark it as visited
+
999  // and push it to the queue
+
1000  if (std::find(visited.begin(), visited.end(), *(elem.first)) == visited.end())
+
1001  {
+
1002  visited.push_back(*(elem.first));
+
1003  tracker.push(elem.first);
+
1004  }
+
1005  }
+
1006  }
+
1007  }
+
1008 
+
1009  return visited;
+
1010  }
+
1011 
+
1012  template <typename T>
+
1013  const std::vector<Node<T>> Graph<T>::depth_first_search(const Node<T> &start) const
+
1014  {
+
1015  // vector to keep track of visited nodes
+
1016  std::vector<Node<T>> visited;
+
1017  auto nodeSet = getNodeSet();
+
1018  //check is exist node in the graph
+
1019  if (std::find(nodeSet.begin(), nodeSet.end(), &start) == nodeSet.end())
+
1020  {
+
1021  return visited;
+
1022  }
+
1023  const AdjacencyMatrix<T> adj = getAdjMatrix();
+
1024  std::function<void(const AdjacencyMatrix<T> &, const Node<T> &, std::vector<Node<T>> &)> explore;
+
1025  explore = [&explore](const AdjacencyMatrix<T> &adj, const Node<T> &node, std::vector<Node<T>> &visited) -> void
+
1026  {
+
1027  visited.push_back(node);
+
1028  if (adj.find(&node) != adj.end())
+
1029  {
+
1030  for (auto x : adj.at(&node))
+
1031  {
+
1032  if (std::find(visited.begin(), visited.end(), *(x.first)) == visited.end())
+
1033  {
+
1034  explore(adj, *(x.first), visited);
+
1035  }
+
1036  }
+
1037  }
+
1038  };
+
1039  explore(adj, start, visited);
+
1040 
+
1041  return visited;
+
1042  }
+
1043 
+
1044  template <typename T>
+ +
1046  {
+
1047  if (!isDirectedGraph())
+
1048  {
+
1049  return false;
+
1050  }
+
1051  enum nodeStates : uint8_t
+
1052  {
+
1053  not_visited,
+
1054  in_stack,
+
1055  visited
+
1056  };
+
1057  auto nodeSet = this->getNodeSet();
+
1058  auto adjMatrix = this->getAdjMatrix();
+
1059 
+
1060  /* State of the node.
+
1061  *
+
1062  * It is a vector of "nodeStates" which represents the state node is in.
+
1063  * It can take only 3 values: "not_visited", "in_stack", and "visited".
+
1064  *
+
1065  * Initially, all nodes are in "not_visited" state.
+
1066  */
+
1067  std::map<unsigned long, nodeStates> state;
+
1068  for (auto node : nodeSet)
+
1069  {
+
1070  state[node->getId()] = not_visited;
+
1071  }
+
1072  int stateCounter = 0;
+
1073 
+
1074  // Start visiting each node.
+
1075  for (auto node : nodeSet)
+
1076  {
+
1077  // If a node is not visited, only then check for presence of cycle.
+
1078  // There is no need to check for presence of cycle for a visited
+
1079  // node as it has already been checked for presence of cycle.
+
1080  if (state[node->getId()] == not_visited)
+
1081  {
+
1082  // Check for cycle.
+
1083  std::function<bool(AdjacencyMatrix<T> &, std::map<unsigned long, nodeStates> &, const Node<T> *)> isCyclicDFSHelper;
+
1084  isCyclicDFSHelper = [this, &isCyclicDFSHelper](AdjacencyMatrix<T> &adjMatrix, std::map<unsigned long, nodeStates> &states, const Node<T> *node)
+
1085  {
+
1086  // Add node "in_stack" state.
+
1087  states[node->getId()] = in_stack;
+
1088 
+
1089  // If the node has children, then recursively visit all children of the
+
1090  // node.
+
1091  auto const it = adjMatrix.find(node);
+
1092  if (it != adjMatrix.end())
+
1093  {
+
1094  for (auto child : it->second)
+
1095  {
+
1096  // If state of child node is "not_visited", evaluate that child
+
1097  // for presence of cycle.
+
1098  auto state_of_child = states.at((std::get<0>(child))->getId());
+
1099  if (state_of_child == not_visited)
+
1100  {
+
1101  if (isCyclicDFSHelper(adjMatrix, states, std::get<0>(child)))
+
1102  {
+
1103  return true;
+
1104  }
+
1105  }
+
1106  else if (state_of_child == in_stack)
+
1107  {
+
1108  // If child node was "in_stack", then that means that there
+
1109  // is a cycle in the graph. Return true for presence of the
+
1110  // cycle.
+
1111  return true;
+
1112  }
+
1113  }
+
1114  }
+
1115 
+
1116  // Current node has been evaluated for the presence of cycle and had no
+
1117  // cycle. Mark current node as "visited".
+
1118  states[node->getId()] = visited;
+
1119  // Return that current node didn't result in any cycles.
+
1120  return false;
+
1121  };
+
1122  if (isCyclicDFSHelper(adjMatrix, state, node))
+
1123  {
+
1124  return true;
+
1125  }
+
1126  }
+
1127  }
+
1128 
+
1129  // All nodes have been safely traversed, that means there is no cycle in
+
1130  // the graph. Return false.
+
1131  return false;
+
1132  }
1133 
-
1134  if (readNodeFeat)
-
1135  {
-
1136  std::string completePathToFileNodeFeat = workingDir + "/" + OFileName + "_NodeFeat"
-
1137  ".tsv";
-
1138  ifileNodeFeat.open(completePathToFileNodeFeat);
-
1139  if (!ifileNodeFeat.is_open())
-
1140  {
-
1141  // ERROR File Not Open
-
1142  return -1;
-
1143  }
-
1144  for (;;)
-
1145  { /* loop continually */
-
1146  unsigned long nodeId;
-
1147  T nodeFeat;
-
1148  ifileNodeFeat >> nodeId >> std::ws >> nodeFeat;
-
1149  nodeFeatMap[nodeId] = nodeFeat;
-
1150  if (ifileNodeFeat.fail() || ifileNodeFeat.eof())
-
1151  break;
-
1152  ifileNodeFeat.ignore(128, '\n');
-
1153  }
-
1154  ifileNodeFeat.close();
-
1155  }
-
1156 
-
1157  if (readEdgeWeight)
-
1158  {
-
1159  std::string completePathToFileEdgeWeight = workingDir + "/" + OFileName + "_EdgeWeight"
-
1160  ".tsv";
-
1161  ifileEdgeWeight.open(completePathToFileEdgeWeight);
-
1162  if (!ifileEdgeWeight.is_open())
-
1163  {
-
1164  // ERROR File Not Open
-
1165  return -1;
-
1166  }
-
1167  for (;;)
-
1168  { /* loop continually */
-
1169  unsigned long edgeId;
-
1170  double weight;
-
1171  bool weighted;
-
1172  ifileEdgeWeight >> edgeId >> std::ws >> weight >> std::ws >> weighted;
-
1173  if (weighted)
-
1174  {
-
1175  edgeWeightMap[edgeId] = weight;
-
1176  }
-
1177  if (ifileEdgeWeight.fail() || ifileEdgeWeight.eof())
-
1178  break;
-
1179  ifileEdgeWeight.ignore(128, '\n');
-
1180  }
-
1181  ifileEdgeWeight.close();
-
1182  }
-
1183  recreateGraphFromReadFiles(edgeMap, edgeDirectedMap, nodeFeatMap, edgeWeightMap);
-
1184  return 0;
-
1185  }
-
1186 
-
1187  template <typename T>
-
1188  void Graph<T>::recreateGraphFromReadFiles(std::map<unsigned long, std::pair<unsigned long, unsigned long>> &edgeMap, std::map<unsigned long, bool> &edgeDirectedMap, std::map<unsigned long, T> &nodeFeatMap, std::map<unsigned long, double> &edgeWeightMap)
-
1189  {
-
1190  std::map<unsigned long, Node<T> *> nodeMap;
-
1191  for (auto edgeIt = edgeMap.begin(); edgeIt != edgeMap.end(); ++edgeIt)
-
1192  {
-
1193  Node<T> *node1 = nullptr;
-
1194  Node<T> *node2 = nullptr;
-
1195  if (nodeMap.find(edgeIt->second.first) == nodeMap.end())
-
1196  {
-
1197  //Create new Node
-
1198  T feat;
-
1199  if (nodeFeatMap.find(edgeIt->second.first) != nodeFeatMap.end())
-
1200  {
-
1201  feat = nodeFeatMap.at(edgeIt->second.first);
-
1202  }
-
1203  node1 = new Node<T>(edgeIt->second.first, feat);
-
1204  nodeMap[edgeIt->second.first] = node1;
-
1205  }
-
1206  else
-
1207  {
-
1208  node1 = nodeMap.at(edgeIt->second.first);
-
1209  }
-
1210  if (nodeMap.find(edgeIt->second.second) == nodeMap.end())
-
1211  {
-
1212  //Create new Node
-
1213  T feat;
-
1214  if (nodeFeatMap.find(edgeIt->second.second) != nodeFeatMap.end())
-
1215  {
-
1216  feat = nodeFeatMap.at(edgeIt->second.second);
-
1217  }
-
1218  node2 = new Node<T>(edgeIt->second.second, feat);
-
1219  nodeMap[edgeIt->second.second] = node2;
-
1220  }
-
1221  else
-
1222  {
-
1223  node2 = nodeMap.at(edgeIt->second.second);
-
1224  }
-
1225 
-
1226  if (edgeWeightMap.find(edgeIt->first) != edgeWeightMap.end())
-
1227  {
-
1228  if (edgeDirectedMap.find(edgeIt->first) != edgeDirectedMap.end() && edgeDirectedMap.at(edgeIt->first))
-
1229  {
-
1230  auto edge = new DirectedWeightedEdge<T>(edgeIt->first, *node1, *node2, edgeWeightMap.at(edgeIt->first));
-
1231  addEdge(edge);
-
1232  }
-
1233  else
-
1234  {
-
1235  auto edge = new UndirectedWeightedEdge<T>(edgeIt->first, *node1, *node2, edgeWeightMap.at(edgeIt->first));
-
1236  addEdge(edge);
-
1237  }
-
1238  }
-
1239  else
-
1240  {
-
1241  if (edgeDirectedMap.find(edgeIt->first) != edgeDirectedMap.end() && edgeDirectedMap.at(edgeIt->first))
-
1242  {
-
1243  auto edge = new DirectedEdge<T>(edgeIt->first, *node1, *node2);
-
1244  addEdge(edge);
-
1245  }
-
1246  else
-
1247  {
-
1248  auto edge = new UndirectedEdge<T>(edgeIt->first, *node1, *node2);
-
1249  addEdge(edge);
-
1250  }
-
1251  }
-
1252  }
-
1253  }
+
1134  template <typename T>
+ +
1136  {
+
1137  if (!isDirectedGraph())
+
1138  {
+
1139  return false;
+
1140  }
+
1141  auto adjMatrix = this->getAdjMatrix();
+
1142  auto nodeSet = this->getNodeSet();
+
1143 
+
1144  std::map<unsigned long, unsigned int> indegree;
+
1145  for (auto node : nodeSet)
+
1146  {
+
1147  indegree[node->getId()] = 0;
+
1148  }
+
1149  // Calculate the indegree i.e. the number of incident edges to the node.
+
1150  for (auto const &list : adjMatrix)
+
1151  {
+
1152  auto children = list.second;
+
1153  for (auto const &child : children)
+
1154  {
+
1155  indegree[std::get<0>(child)->getId()]++;
+
1156  }
+
1157  }
+
1158 
+
1159  std::queue<const Node<T> *> can_be_solved;
+
1160  for (auto node : nodeSet)
+
1161  {
+
1162  // If a node doesn't have any input edges, then that node will
+
1163  // definately not result in a cycle and can be visited safely.
+
1164  if (!indegree[node->getId()])
+
1165  {
+
1166  can_be_solved.emplace(&(*node));
+
1167  }
+
1168  }
+
1169 
+
1170  // Vertices that need to be traversed.
+
1171  auto remain = this->getNodeSet().size();
+
1172  // While there are safe nodes that we can visit.
+
1173  while (!can_be_solved.empty())
+
1174  {
+
1175  auto solved = can_be_solved.front();
+
1176  // Visit the node.
+
1177  can_be_solved.pop();
+
1178  // Decrease number of nodes that need to be traversed.
+
1179  remain--;
+
1180 
+
1181  // Visit all the children of the visited node.
+
1182  auto it = adjMatrix.find(solved);
+
1183  if (it != adjMatrix.end())
+
1184  {
+
1185  for (auto child : it->second)
+
1186  {
+
1187  // Check if we can visited the node safely.
+
1188  if (--indegree[std::get<0>(child)->getId()] == 0)
+
1189  {
+
1190  // if node can be visited safely, then add that node to
+
1191  // the visit queue.
+
1192  can_be_solved.emplace(std::get<0>(child));
+
1193  }
+
1194  }
+
1195  }
+
1196  }
+
1197 
+
1198  // If there are still nodes that we can't visit, then it means that
+
1199  // there is a cycle and return true, else return false.
+
1200  return !(remain == 0);
+
1201  }
+
1202 
+
1203  template <typename T>
+ +
1205  {
+
1206  auto edgeSet = this->getEdgeSet();
+
1207  for (auto edge : edgeSet)
+
1208  {
+
1209  if (!(edge->isDirected().has_value() && edge->isDirected().value()))
+
1210  {
+
1211  //Found Undirected Edge
+
1212  return false;
+
1213  }
+
1214  }
+
1215  //No Undirected Edge
+
1216  return true;
+
1217  }
+
1218 
+
1219  template <typename T>
+
1220  const DialResult Graph<T>::dial(const Node<T> &source, int maxWeight) const
+
1221  {
+
1222  DialResult result;
+
1223  result.success = false;
+
1224 
+
1225  auto adj = getAdjMatrix();
+
1226  auto nodeSet = getNodeSet();
+
1227 
+
1228  if (std::find(nodeSet.begin(), nodeSet.end(), &source) == nodeSet.end())
+
1229  {
+
1230  // check if source node exist in the graph
+
1231  result.errorMessage = ERR_SOURCE_NODE_NOT_IN_GRAPH;
+
1232  return result;
+
1233  }
+
1234  /* With each distance, iterator to that vertex in
+
1235  its bucket is stored so that vertex can be deleted
+
1236  in O(1) at time of updation. So
+
1237  dist[i].first = distance of ith vertex from src vertex
+
1238  dits[i].second = vertex i in bucket number */
+
1239  unsigned int V = nodeSet.size();
+
1240  std::map<const Node<T> *, std::pair<long, const Node<T> *>> dist;
+
1241 
+
1242  // Initialize all distances as infinite (INF)
+
1243  for (auto node : nodeSet)
+
1244  {
+
1245  dist[&(*node)].first = std::numeric_limits<long>::max();
+
1246  }
+
1247 
+
1248  // Create buckets B[].
+
1249  // B[i] keep vertex of distance label i
+
1250  std::list<const Node<T> *> B[maxWeight * V + 1];
+
1251 
+
1252  B[0].push_back(&source);
+
1253  dist[&source].first = 0;
1254 
-
1255  template <typename T>
-
1256  int Graph<T>::compressFile(const std::string &inputFile, const std::string &outputFile) const
-
1257  {
-
1258 
-
1259  std::ifstream ifs;
-
1260  ifs.open(inputFile);
-
1261  if (!ifs.is_open())
-
1262  {
-
1263  // ERROR File Not Open
-
1264  return -1;
-
1265  }
-
1266  std::string content((std::istreambuf_iterator<char>(ifs)),
-
1267  (std::istreambuf_iterator<char>()));
-
1268 
-
1269  const char *content_ptr = content.c_str();
-
1270  gzFile outFileZ = gzopen(outputFile.c_str(), "wb");
-
1271  if (outFileZ == NULL)
-
1272  {
-
1273  //printf("Error: Failed to gzopen %s\n", outputFile.c_str());
-
1274  return -1;
-
1275  }
-
1276 
-
1277  unsigned int zippedBytes;
-
1278  zippedBytes = gzwrite(outFileZ, content_ptr, strlen(content_ptr));
-
1279 
-
1280  ifs.close();
-
1281  gzclose(outFileZ);
-
1282  return 0;
-
1283  }
-
1284 
-
1285  template <typename T>
-
1286  int Graph<T>::decompressFile(const std::string &inputFile, const std::string &outputFile) const
-
1287  {
-
1288 
-
1289  gzFile inFileZ = gzopen(inputFile.c_str(), "rb");
-
1290  if (inFileZ == NULL)
-
1291  {
-
1292  //printf("Error: Failed to gzopen %s\n", inputFile.c_str());
-
1293  return -1;
-
1294  }
-
1295  unsigned char unzipBuffer[8192];
-
1296  unsigned int unzippedBytes;
-
1297  std::vector<unsigned char> unzippedData;
-
1298  std::ofstream ofs;
-
1299  ofs.open(outputFile);
-
1300  if (!ofs.is_open())
-
1301  {
-
1302  // ERROR File Not Open
-
1303  return -1;
-
1304  }
-
1305  while (true)
-
1306  {
-
1307  unzippedBytes = gzread(inFileZ, unzipBuffer, 8192);
-
1308  if (unzippedBytes > 0)
-
1309  {
-
1310  unzippedData.insert(unzippedData.end(), unzipBuffer, unzipBuffer + unzippedBytes);
-
1311  }
-
1312  else
-
1313  {
-
1314  break;
-
1315  }
-
1316  }
-
1317  for (auto c : unzippedData)
-
1318  {
-
1319  ofs << c;
-
1320  }
-
1321  ofs << std::endl;
-
1322  ofs.close();
-
1323  gzclose(inFileZ);
-
1324  return 0;
-
1325  }
-
1326 
-
1327  template <typename T>
-
1328  void Graph<T>::greedyPartition(PartitionMap<T> &partitionMap) const
-
1329  {
-
1330  unsigned int index = 0;
-
1331  unsigned int numberOfPartitions = partitionMap.size();
-
1332  if (index == numberOfPartitions)
-
1333  {
-
1334  //ERROR partition map of zero element
-
1335  return;
-
1336  }
-
1337  auto edgeSet = getEdgeSet();
-
1338  for (auto edge : edgeSet)
+
1255  int idx = 0;
+
1256  while (1)
+
1257  {
+
1258  // Go sequentially through buckets till one non-empty
+
1259  // bucket is found
+
1260  while (B[idx].size() == 0 && idx < maxWeight * V)
+
1261  {
+
1262  idx++;
+
1263  }
+
1264 
+
1265  // If all buckets are empty, we are done.
+
1266  if (idx == maxWeight * V)
+
1267  {
+
1268  break;
+
1269  }
+
1270 
+
1271  // Take top vertex from bucket and pop it
+
1272  auto u = B[idx].front();
+
1273  B[idx].pop_front();
+
1274 
+
1275  // Process all adjacents of extracted vertex 'u' and
+
1276  // update their distanced if required.
+
1277  for (auto i = adj[u].begin(); i != adj[u].end(); ++i)
+
1278  {
+
1279  auto v = (*i).first;
+
1280  int weight = 0;
+
1281  if ((*i).second->isWeighted().has_value() && (*i).second->isWeighted().value())
+
1282  {
+
1283  if ((*i).second->isDirected().has_value() && (*i).second->isDirected().value())
+
1284  {
+
1285  const DirectedWeightedEdge<T> *dw_edge = dynamic_cast<const DirectedWeightedEdge<T> *>((*i).second);
+
1286  weight = dw_edge->getWeight();
+
1287  }
+
1288  else if ((*i).second->isDirected().has_value() && !(*i).second->isDirected().value())
+
1289  {
+
1290  const UndirectedWeightedEdge<T> *udw_edge = dynamic_cast<const UndirectedWeightedEdge<T> *>((*i).second);
+
1291  weight = udw_edge->getWeight();
+
1292  }
+
1293  else
+
1294  {
+
1295  //ERROR it shouldn't never returned ( does not exist a Node Weighted and not Directed/Undirected)
+
1296  result.errorMessage = ERR_NO_DIR_OR_UNDIR_EDGE;
+
1297  return result;
+
1298  }
+
1299  }
+
1300  else
+
1301  {
+
1302  // No Weighted Edge
+
1303  result.errorMessage = ERR_NO_WEIGHTED_EDGE;
+
1304  return result;
+
1305  }
+
1306  auto u_i = std::find_if(dist.begin(), dist.end(), [u](std::pair<const Node<T> *, std::pair<long, const Node<T> *>> const &it)
+
1307  { return (*u == *(it.first)); });
+
1308 
+
1309  auto v_i = std::find_if(dist.begin(), dist.end(), [v](std::pair<const Node<T> *, std::pair<long, const Node<T> *>> const &it)
+
1310  { return (*v == *(it.first)); });
+
1311  long du = u_i->second.first;
+
1312  long dv = v_i->second.first;
+
1313 
+
1314  // If there is shorted path to v through u.
+
1315  if (dv > du + weight)
+
1316  {
+
1317  // If dv is not INF then it must be in B[dv]
+
1318  // bucket, so erase its entry using iterator
+
1319  // in O(1)
+
1320  if (dv != std::numeric_limits<long>::max())
+
1321  {
+
1322  auto findIter = std::find(B[dv].begin(), B[dv].end(), dist[v].second);
+
1323  B[dv].erase(findIter);
+
1324  }
+
1325 
+
1326  // updating the distance
+
1327  dist[v].first = du + weight;
+
1328  dv = dist[v].first;
+
1329 
+
1330  // pushing vertex v into updated distance's bucket
+
1331  B[dv].push_front(v);
+
1332 
+
1333  // storing updated iterator in dist[v].second
+
1334  dist[v].second = *(B[dv].begin());
+
1335  }
+
1336  }
+
1337  }
+
1338  for (auto dist_i : dist)
1339  {
-
1340  partitionMap.at(index)->addEdge(edge);
-
1341  index++;
-
1342  index = index % numberOfPartitions;
-
1343  }
-
1344  }
-
1345 
-
1346  template <typename T>
-
1347  const AdjacencyMatrix<T> Graph<T>::getAdjMatrix() const
-
1348  {
-
1349  AdjacencyMatrix<T> adj;
-
1350  auto edgeSetIt = edgeSet.begin();
-
1351  for (edgeSetIt; edgeSetIt != edgeSet.end(); ++edgeSetIt)
+
1340  result.minDistanceMap[dist_i.first->getId()] = dist_i.second.first;
+
1341  }
+
1342  result.success = true;
+
1343 
+
1344  return result;
+
1345  }
+
1346 
+
1347  template <typename T>
+
1348  int Graph<T>::writeToFile(InputOutputFormat format, const std::string &workingDir, const std::string &OFileName, bool compress, bool writeNodeFeat, bool writeEdgeWeight) const
+
1349  {
+
1350  int result = 0;
+
1351  if (format == InputOutputFormat::STANDARD_CSV)
1352  {
-
1353  if ((*edgeSetIt)->isDirected().has_value() && (*edgeSetIt)->isDirected().value())
-
1354  {
-
1355  const DirectedEdge<T> *d_edge = dynamic_cast<const DirectedEdge<T> *>(*edgeSetIt);
-
1356  addElementToAdjMatrix(adj, &(d_edge->getFrom()), &(d_edge->getTo()), d_edge);
-
1357  }
-
1358  else if ((*edgeSetIt)->isDirected().has_value() && !(*edgeSetIt)->isDirected().value())
-
1359  {
-
1360  const UndirectedEdge<T> *ud_edge = dynamic_cast<const UndirectedEdge<T> *>(*edgeSetIt);
-
1361  ;
-
1362  addElementToAdjMatrix(adj, &(ud_edge->getNode1()), &(ud_edge->getNode2()), ud_edge);
-
1363  addElementToAdjMatrix(adj, &(ud_edge->getNode2()), &(ud_edge->getNode1()), ud_edge);
-
1364  }
-
1365  else
-
1366  { //is a simple edge we cannot create adj matrix
-
1367  return adj;
-
1368  }
-
1369  }
-
1370  return adj;
-
1371  }
-
1372 
-
1373  template <typename T>
-
1374  const DijkstraResult Graph<T>::dijkstra(const Node<T> &source, const Node<T> &target) const
-
1375  {
-
1376  DijkstraResult result;
-
1377  result.success = false;
-
1378  result.errorMessage = "";
-
1379  result.result = INF_DOUBLE;
-
1380  auto nodeSet = getNodeSet();
-
1381  if (std::find(nodeSet.begin(), nodeSet.end(), &source) == nodeSet.end())
-
1382  {
-
1383  // check if source node exist in the graph
-
1384  result.errorMessage = ERR_SOURCE_NODE_NOT_IN_GRAPH;
-
1385  return result;
-
1386  }
-
1387  if (std::find(nodeSet.begin(), nodeSet.end(), &target) == nodeSet.end())
-
1388  {
-
1389  // check if target node exist in the graph
-
1390  result.errorMessage = ERR_TARGET_NODE_NOT_IN_GRAPH;
-
1391  return result;
-
1392  }
-
1393  const AdjacencyMatrix<T> adj = getAdjMatrix();
-
1394  // n denotes the number of vertices in graph
-
1395  int n = adj.size();
-
1396 
-
1397  // setting all the distances initially to INF_DOUBLE
-
1398  std::map<const Node<T> *, double> dist;
-
1399 
-
1400  for (auto elem : adj)
-
1401  {
-
1402  dist[elem.first] = INF_DOUBLE;
-
1403  }
-
1404 
-
1405  // creating a min heap using priority queue
-
1406  // first element of pair contains the distance
-
1407  // second element of pair contains the vertex
-
1408  std::priority_queue<std::pair<double, const Node<T> *>, std::vector<std::pair<double, const Node<T> *>>,
-
1409  std::greater<std::pair<double, const Node<T> *>>>
-
1410  pq;
-
1411 
-
1412  // pushing the source vertex 's' with 0 distance in min heap
-
1413  pq.push(std::make_pair(0.0, &source));
-
1414 
-
1415  // marking the distance of source as 0
-
1416  dist[&source] = 0;
-
1417 
-
1418  while (!pq.empty())
-
1419  {
-
1420  // second element of pair denotes the node / vertex
-
1421  const Node<T> *currentNode = pq.top().second;
-
1422 
-
1423  // first element of pair denotes the distance
-
1424  double currentDist = pq.top().first;
-
1425 
-
1426  pq.pop();
-
1427 
-
1428  // for all the reachable vertex from the currently exploring vertex
-
1429  // we will try to minimize the distance
-
1430  if (adj.find(currentNode) != adj.end())
-
1431  {
-
1432  for (std::pair<const Node<T> *, const Edge<T> *> elem : adj.at(currentNode))
-
1433  {
-
1434  // minimizing distances
-
1435  if (elem.second->isWeighted().has_value() && elem.second->isWeighted().value())
-
1436  {
-
1437  if (elem.second->isDirected().has_value() && elem.second->isDirected().value())
-
1438  {
-
1439  const DirectedWeightedEdge<T> *dw_edge = dynamic_cast<const DirectedWeightedEdge<T> *>(elem.second);
-
1440  if (currentDist + dw_edge->getWeight() < dist[elem.first])
-
1441  {
-
1442  dist[elem.first] = currentDist + dw_edge->getWeight();
-
1443  pq.push(std::make_pair(dist[elem.first], elem.first));
-
1444  }
-
1445  }
-
1446  else if (elem.second->isDirected().has_value() && !elem.second->isDirected().value())
-
1447  {
-
1448  const UndirectedWeightedEdge<T> *udw_edge = dynamic_cast<const UndirectedWeightedEdge<T> *>(elem.second);
-
1449  if (currentDist + udw_edge->getWeight() < dist[elem.first])
-
1450  {
-
1451  dist[elem.first] = currentDist + udw_edge->getWeight();
-
1452  pq.push(std::make_pair(dist[elem.first], elem.first));
-
1453  }
-
1454  }
-
1455  else
-
1456  {
-
1457  //ERROR it shouldn't never returned ( does not exist a Node Weighted and not Directed/Undirected)
-
1458  result.errorMessage = ERR_NO_DIR_OR_UNDIR_EDGE;
-
1459  return result;
-
1460  }
-
1461  }
-
1462  else
-
1463  {
-
1464  // No Weighted Edge
-
1465  result.errorMessage = ERR_NO_WEIGHTED_EDGE;
-
1466  return result;
-
1467  }
-
1468  }
-
1469  }
-
1470  }
-
1471  if (dist[&target] != INF_DOUBLE)
-
1472  {
-
1473  result.success = true;
-
1474  result.errorMessage = "";
-
1475  result.result = dist[&target];
-
1476  return result;
-
1477  }
-
1478  result.errorMessage = ERR_TARGET_NODE_NOT_REACHABLE;
-
1479  result.result = -1;
-
1480  return result;
-
1481  }
-
1482 
-
1483  template <typename T>
-
1484  const std::vector<Node<T>> Graph<T>::breadth_first_search(const Node<T> &start) const
-
1485  {
-
1486  // vector to keep track of visited nodes
-
1487  std::vector<Node<T>> visited;
-
1488  auto nodeSet = getNodeSet();
-
1489  //check is exist node in the graph
-
1490  if (std::find(nodeSet.begin(), nodeSet.end(), &start) == nodeSet.end())
-
1491  {
-
1492  return visited;
-
1493  }
-
1494  const AdjacencyMatrix<T> adj = getAdjMatrix();
-
1495  // queue that stores vertices that need to be further explored
-
1496  std::queue<const Node<T> *> tracker;
-
1497 
-
1498  // mark the starting node as visited
-
1499  visited.push_back(start);
-
1500  tracker.push(&start);
-
1501  while (!tracker.empty())
-
1502  {
-
1503  const Node<T> *node = tracker.front();
-
1504  tracker.pop();
-
1505  if (adj.find(node) != adj.end())
-
1506  {
-
1507  for (auto elem : adj.at(node))
-
1508  {
-
1509  // if the node is not visited then mark it as visited
-
1510  // and push it to the queue
-
1511  if (std::find(visited.begin(), visited.end(), *(elem.first)) == visited.end())
-
1512  {
-
1513  visited.push_back(*(elem.first));
-
1514  tracker.push(elem.first);
-
1515  }
-
1516  }
-
1517  }
-
1518  }
-
1519 
-
1520  return visited;
-
1521  }
-
1522 
-
1523  template <typename T>
-
1524  const std::vector<Node<T>> Graph<T>::depth_first_search(const Node<T> &start) const
-
1525  {
-
1526  // vector to keep track of visited nodes
-
1527  std::vector<Node<T>> visited;
-
1528  auto nodeSet = getNodeSet();
-
1529  //check is exist node in the graph
-
1530  if (std::find(nodeSet.begin(), nodeSet.end(), &start) == nodeSet.end())
-
1531  {
-
1532  return visited;
-
1533  }
-
1534  const AdjacencyMatrix<T> adj = getAdjMatrix();
-
1535  std::function<void(const AdjacencyMatrix<T> &, const Node<T> &, std::vector<Node<T>> &)> explore;
-
1536  explore = [&explore](const AdjacencyMatrix<T> &adj, const Node<T> &node, std::vector<Node<T>> &visited) -> void
-
1537  {
-
1538  visited.push_back(node);
-
1539  if (adj.find(&node) != adj.end())
-
1540  {
-
1541  for (auto x : adj.at(&node))
-
1542  {
-
1543  if (std::find(visited.begin(), visited.end(), *(x.first)) == visited.end())
-
1544  {
-
1545  explore(adj, *(x.first), visited);
-
1546  }
-
1547  }
-
1548  }
-
1549  };
-
1550  explore(adj, start, visited);
-
1551 
-
1552  return visited;
+
1353  result = writeToStandardFile_csv(workingDir, OFileName, compress, writeNodeFeat, writeEdgeWeight);
+
1354  }
+
1355  else if (format == InputOutputFormat::STANDARD_TSV)
+
1356  {
+
1357  result = writeToStandardFile_tsv(workingDir, OFileName, compress, writeNodeFeat, writeEdgeWeight);
+
1358  }
+
1359  else
+
1360  {
+
1361  //OUTPUT FORMAT NOT RECOGNIZED
+
1362  return -1;
+
1363  }
+
1364  if (result == 0 && compress)
+
1365  {
+
1366  auto compress = [this, &workingDir, &OFileName, &writeNodeFeat, &writeEdgeWeight](const std::string &extension)
+
1367  {
+
1368  std::string completePathToFileGraph = workingDir + "/" + OFileName + extension;
+
1369  std::string completePathToFileGraphCompressed = workingDir + "/" + OFileName + extension + ".gz";
+
1370  int _result = compressFile(completePathToFileGraph, completePathToFileGraphCompressed);
+
1371  if (_result == 0)
+
1372  {
+
1373  _result = remove(completePathToFileGraph.c_str());
+
1374  }
+
1375  if (_result == 0)
+
1376  {
+
1377  if (writeNodeFeat)
+
1378  {
+
1379  std::string completePathToFileNodeFeat = workingDir + "/" + OFileName + "_NodeFeat" + extension;
+
1380  std::string completePathToFileNodeFeatCompressed = workingDir + "/" + OFileName + "_NodeFeat" + extension + ".gz";
+
1381  _result = compressFile(completePathToFileNodeFeat, completePathToFileNodeFeatCompressed);
+
1382  if (_result == 0)
+
1383  {
+
1384  _result = remove(completePathToFileNodeFeat.c_str());
+
1385  }
+
1386  }
+
1387  }
+
1388  if (_result == 0)
+
1389  {
+
1390  if (writeEdgeWeight)
+
1391  {
+
1392  std::string completePathToFileEdgeWeight = workingDir + "/" + OFileName + "_EdgeWeight" + extension;
+
1393  std::string completePathToFileEdgeWeightCompressed = workingDir + "/" + OFileName + "_EdgeWeight" + extension + ".gz";
+
1394  _result = compressFile(completePathToFileEdgeWeight, completePathToFileEdgeWeightCompressed);
+
1395  if (_result == 0)
+
1396  {
+
1397  _result = remove(completePathToFileEdgeWeight.c_str());
+
1398  }
+
1399  }
+
1400  }
+
1401  return _result;
+
1402  };
+
1403  if (format == InputOutputFormat::STANDARD_CSV)
+
1404  {
+
1405  auto result = compress(".csv");
+
1406  }
+
1407  else if (format == InputOutputFormat::STANDARD_TSV)
+
1408  {
+
1409  auto result = compress(".tsv");
+
1410  }
+
1411  else
+
1412  {
+
1413  //OUTPUT FORMAT NOT RECOGNIZED
+
1414  result = -1;
+
1415  }
+
1416  }
+
1417  return result;
+
1418  }
+
1419 
+
1420  template <typename T>
+
1421  int Graph<T>::readFromFile(InputOutputFormat format, const std::string &workingDir, const std::string &OFileName, bool compress, bool readNodeFeat, bool readEdgeWeight)
+
1422  {
+
1423  int result = 0;
+
1424  if (compress)
+
1425  {
+
1426  auto decompress = [this, &workingDir, &OFileName, &readNodeFeat, &readEdgeWeight](const std::string &extension)
+
1427  {
+
1428  std::string completePathToFileGraph = workingDir + "/" + OFileName + extension;
+
1429  std::string completePathToFileGraphCompressed = workingDir + "/" + OFileName + extension + ".gz";
+
1430  int _result = decompressFile(completePathToFileGraphCompressed, completePathToFileGraph);
+
1431  if (_result == 0)
+
1432  {
+
1433  if (readNodeFeat)
+
1434  {
+
1435  std::string completePathToFileNodeFeat = workingDir + "/" + OFileName + "_NodeFeat" + extension;
+
1436  std::string completePathToFileNodeFeatCompressed = workingDir + "/" + OFileName + "_NodeFeat" + extension + ".gz";
+
1437  _result = decompressFile(completePathToFileNodeFeatCompressed, completePathToFileNodeFeat);
+
1438  }
+
1439  }
+
1440  if (_result == 0)
+
1441  {
+
1442  if (readEdgeWeight)
+
1443  {
+
1444  std::string completePathToFileEdgeWeight = workingDir + "/" + OFileName + "_EdgeWeight" + extension;
+
1445  std::string completePathToFileEdgeWeightCompressed = workingDir + "/" + OFileName + "_EdgeWeight" + extension + ".gz";
+
1446  _result = decompressFile(completePathToFileEdgeWeightCompressed, completePathToFileEdgeWeight);
+
1447  }
+
1448  }
+
1449  return _result;
+
1450  };
+
1451  if (format == InputOutputFormat::STANDARD_CSV)
+
1452  {
+
1453  result = decompress(".csv");
+
1454  }
+
1455  else if (format == InputOutputFormat::STANDARD_TSV)
+
1456  {
+
1457  result = decompress(".tsv");
+
1458  }
+
1459  else
+
1460  {
+
1461  //OUTPUT FORMAT NOT RECOGNIZED
+
1462  result = -1;
+
1463  }
+
1464  }
+
1465  if (result == 0)
+
1466  {
+
1467  if (format == InputOutputFormat::STANDARD_CSV)
+
1468  {
+
1469  result = readFromStandardFile_csv(workingDir, OFileName, compress, readNodeFeat, readEdgeWeight);
+
1470  }
+
1471  else if (format == InputOutputFormat::STANDARD_TSV)
+
1472  {
+
1473  result = readFromStandardFile_tsv(workingDir, OFileName, compress, readNodeFeat, readEdgeWeight);
+
1474  }
+
1475  else
+
1476  {
+
1477  //OUTPUT FORMAT NOT RECOGNIZED
+
1478  result = -1;
+
1479  }
+
1480  }
+
1481  return result;
+
1482  }
+
1483 
+
1484  template <typename T>
+
1485  PartitionMap<T> Graph<T>::partitionGraph(PARTITIONING::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const
+
1486  {
+
1487  PartitionMap<T> partitionMap;
+
1488  for (unsigned int i = 0; i < numberOfPartitions; ++i)
+
1489  {
+
1490  partitionMap[i] = new PARTITIONING::Partition<T>(i);
+
1491  }
+
1492  if (algorithm == PARTITIONING::PartitionAlgorithm::GREEDY_VC_ALG)
+
1493  {
+
1494  greedyPartition(partitionMap);
+
1495  }
+
1496  else if (algorithm == PARTITIONING::PartitionAlgorithm::HDRF_ALG)
+
1497  {
+
1498  HDRFPartition(partitionMap);
+
1499  }
+
1500  else
+
1501  {
+
1502  //Error not recognized algorithm
+
1503  partitionMap.clear();
+
1504  }
+
1505  return partitionMap;
+
1506  }
+
1507 
+
1508 
+
1509  template <typename T>
+
1510  std::ostream &operator<<(std::ostream &os, const AdjacencyMatrix<T> &adj)
+
1511  {
+
1512  os << "Adjacency Matrix:\n";
+
1513  auto it = adj.begin();
+
1514  unsigned long max_column = 0;
+
1515  for (it; it != adj.end(); ++it)
+
1516  {
+
1517  if (it->second.size() > max_column)
+
1518  {
+
1519  max_column = it->second.size();
+
1520  }
+
1521  }
+
1522  if (max_column == 0)
+
1523  {
+
1524  os << "ERROR in Print\n";
+
1525  return os;
+
1526  }
+
1527  else
+
1528  {
+
1529  it = adj.begin();
+
1530  os << "|--|";
+
1531  for (int i = 0; i < max_column; i++)
+
1532  {
+
1533  os << "-----|";
+
1534  }
+
1535  os << "\n";
+
1536  for (it; it != adj.end(); ++it)
+
1537  {
+
1538  os << "|N" << it->first->getId() << "|";
+
1539  auto it2 = it->second.begin();
+
1540  for (it2; it2 != it->second.end(); ++it2)
+
1541  {
+
1542  os << "N" << it2->first->getId() << ",E" << it2->second->getId() << "|";
+
1543  }
+
1544  os << "\n|--|";
+
1545  for (int i = 0; i < max_column; i++)
+
1546  {
+
1547  os << "-----|";
+
1548  }
+
1549  os << "\n";
+
1550  }
+
1551  }
+
1552  return os;
1553  }
1554 
-
1555  template <typename T>
- -
1557  {
-
1558  if (!isDirectedGraph())
-
1559  {
-
1560  return false;
-
1561  }
-
1562  enum nodeStates : uint8_t
-
1563  {
-
1564  not_visited,
-
1565  in_stack,
-
1566  visited
-
1567  };
-
1568  auto nodeSet = this->getNodeSet();
-
1569  auto adjMatrix = this->getAdjMatrix();
-
1570 
-
1571  /* State of the node.
-
1572  *
-
1573  * It is a vector of "nodeStates" which represents the state node is in.
-
1574  * It can take only 3 values: "not_visited", "in_stack", and "visited".
-
1575  *
-
1576  * Initially, all nodes are in "not_visited" state.
-
1577  */
-
1578  std::map<unsigned long, nodeStates> state;
-
1579  for (auto node : nodeSet)
-
1580  {
-
1581  state[node->getId()] = not_visited;
-
1582  }
-
1583  int stateCounter = 0;
-
1584 
-
1585  // Start visiting each node.
-
1586  for (auto node : nodeSet)
-
1587  {
-
1588  // If a node is not visited, only then check for presence of cycle.
-
1589  // There is no need to check for presence of cycle for a visited
-
1590  // node as it has already been checked for presence of cycle.
-
1591  if (state[node->getId()] == not_visited)
-
1592  {
-
1593  // Check for cycle.
-
1594  std::function<bool(AdjacencyMatrix<T> &, std::map<unsigned long, nodeStates> &, const Node<T> *)> isCyclicDFSHelper;
-
1595  isCyclicDFSHelper = [this, &isCyclicDFSHelper](AdjacencyMatrix<T> &adjMatrix, std::map<unsigned long, nodeStates> &states, const Node<T> *node)
-
1596  {
-
1597  // Add node "in_stack" state.
-
1598  states[node->getId()] = in_stack;
-
1599 
-
1600  // If the node has children, then recursively visit all children of the
-
1601  // node.
-
1602  auto const it = adjMatrix.find(node);
-
1603  if (it != adjMatrix.end())
-
1604  {
-
1605  for (auto child : it->second)
-
1606  {
-
1607  // If state of child node is "not_visited", evaluate that child
-
1608  // for presence of cycle.
-
1609  auto state_of_child = states.at((std::get<0>(child))->getId());
-
1610  if (state_of_child == not_visited)
-
1611  {
-
1612  if (isCyclicDFSHelper(adjMatrix, states, std::get<0>(child)))
-
1613  {
-
1614  return true;
-
1615  }
-
1616  }
-
1617  else if (state_of_child == in_stack)
-
1618  {
-
1619  // If child node was "in_stack", then that means that there
-
1620  // is a cycle in the graph. Return true for presence of the
-
1621  // cycle.
-
1622  return true;
-
1623  }
-
1624  }
-
1625  }
-
1626 
-
1627  // Current node has been evaluated for the presence of cycle and had no
-
1628  // cycle. Mark current node as "visited".
-
1629  states[node->getId()] = visited;
-
1630  // Return that current node didn't result in any cycles.
-
1631  return false;
-
1632  };
-
1633  if (isCyclicDFSHelper(adjMatrix, state, node))
-
1634  {
-
1635  return true;
-
1636  }
-
1637  }
-
1638  }
-
1639 
-
1640  // All nodes have been safely traversed, that means there is no cycle in
-
1641  // the graph. Return false.
-
1642  return false;
-
1643  }
-
1644 
-
1645  template <typename T>
- -
1647  {
-
1648  if (!isDirectedGraph())
-
1649  {
-
1650  return false;
-
1651  }
-
1652  auto adjMatrix = this->getAdjMatrix();
-
1653  auto nodeSet = this->getNodeSet();
-
1654 
-
1655  std::map<unsigned long, unsigned int> indegree;
-
1656  for (auto node : nodeSet)
-
1657  {
-
1658  indegree[node->getId()] = 0;
-
1659  }
-
1660  // Calculate the indegree i.e. the number of incident edges to the node.
-
1661  for (auto const &list : adjMatrix)
-
1662  {
-
1663  auto children = list.second;
-
1664  for (auto const &child : children)
-
1665  {
-
1666  indegree[std::get<0>(child)->getId()]++;
-
1667  }
-
1668  }
-
1669 
-
1670  std::queue<const Node<T> *> can_be_solved;
-
1671  for (auto node : nodeSet)
-
1672  {
-
1673  // If a node doesn't have any input edges, then that node will
-
1674  // definately not result in a cycle and can be visited safely.
-
1675  if (!indegree[node->getId()])
-
1676  {
-
1677  can_be_solved.emplace(&(*node));
-
1678  }
-
1679  }
-
1680 
-
1681  // Vertices that need to be traversed.
-
1682  auto remain = this->getNodeSet().size();
-
1683  // While there are safe nodes that we can visit.
-
1684  while (!can_be_solved.empty())
-
1685  {
-
1686  auto solved = can_be_solved.front();
-
1687  // Visit the node.
-
1688  can_be_solved.pop();
-
1689  // Decrease number of nodes that need to be traversed.
-
1690  remain--;
-
1691 
-
1692  // Visit all the children of the visited node.
-
1693  auto it = adjMatrix.find(solved);
-
1694  if (it != adjMatrix.end())
-
1695  {
-
1696  for (auto child : it->second)
-
1697  {
-
1698  // Check if we can visited the node safely.
-
1699  if (--indegree[std::get<0>(child)->getId()] == 0)
-
1700  {
-
1701  // if node can be visited safely, then add that node to
-
1702  // the visit queue.
-
1703  can_be_solved.emplace(std::get<0>(child));
-
1704  }
-
1705  }
-
1706  }
-
1707  }
-
1708 
-
1709  // If there are still nodes that we can't visit, then it means that
-
1710  // there is a cycle and return true, else return false.
-
1711  return !(remain == 0);
-
1712  }
-
1713 
-
1714  template <typename T>
- -
1716  {
-
1717  auto edgeSet = this->getEdgeSet();
-
1718  for (auto edge : edgeSet)
-
1719  {
-
1720  if (!(edge->isDirected().has_value() && edge->isDirected().value()))
-
1721  {
-
1722  //Found Undirected Edge
-
1723  return false;
-
1724  }
-
1725  }
-
1726  //No Undirected Edge
-
1727  return true;
-
1728  }
-
1729 
-
1730  template <typename T>
-
1731  const DialResult Graph<T>::dial(const Node<T> &source, int maxWeight) const
-
1732  {
-
1733  DialResult result;
-
1734  result.success = false;
-
1735 
-
1736  auto adj = getAdjMatrix();
-
1737  auto nodeSet = getNodeSet();
-
1738 
-
1739  if (std::find(nodeSet.begin(), nodeSet.end(), &source) == nodeSet.end())
-
1740  {
-
1741  // check if source node exist in the graph
-
1742  result.errorMessage = ERR_SOURCE_NODE_NOT_IN_GRAPH;
-
1743  return result;
-
1744  }
-
1745  /* With each distance, iterator to that vertex in
-
1746  its bucket is stored so that vertex can be deleted
-
1747  in O(1) at time of updation. So
-
1748  dist[i].first = distance of ith vertex from src vertex
-
1749  dits[i].second = vertex i in bucket number */
-
1750  unsigned int V = nodeSet.size();
-
1751  std::map<const Node<T> *, std::pair<long, const Node<T> *>> dist;
-
1752 
-
1753  // Initialize all distances as infinite (INF)
-
1754  for (auto node : nodeSet)
-
1755  {
-
1756  dist[&(*node)].first = std::numeric_limits<long>::max();
-
1757  }
-
1758 
-
1759  // Create buckets B[].
-
1760  // B[i] keep vertex of distance label i
-
1761  std::list<const Node<T> *> B[maxWeight * V + 1];
-
1762 
-
1763  B[0].push_back(&source);
-
1764  dist[&source].first = 0;
-
1765 
-
1766  int idx = 0;
-
1767  while (1)
-
1768  {
-
1769  // Go sequentially through buckets till one non-empty
-
1770  // bucket is found
-
1771  while (B[idx].size() == 0 && idx < maxWeight * V)
-
1772  {
-
1773  idx++;
-
1774  }
-
1775 
-
1776  // If all buckets are empty, we are done.
-
1777  if (idx == maxWeight * V)
-
1778  {
-
1779  break;
-
1780  }
-
1781 
-
1782  // Take top vertex from bucket and pop it
-
1783  auto u = B[idx].front();
-
1784  B[idx].pop_front();
-
1785 
-
1786  // Process all adjacents of extracted vertex 'u' and
-
1787  // update their distanced if required.
-
1788  for (auto i = adj[u].begin(); i != adj[u].end(); ++i)
-
1789  {
-
1790  auto v = (*i).first;
-
1791  int weight = 0;
-
1792  if ((*i).second->isWeighted().has_value() && (*i).second->isWeighted().value())
-
1793  {
-
1794  if ((*i).second->isDirected().has_value() && (*i).second->isDirected().value())
-
1795  {
-
1796  const DirectedWeightedEdge<T> *dw_edge = dynamic_cast<const DirectedWeightedEdge<T> *>((*i).second);
-
1797  weight = dw_edge->getWeight();
-
1798  }
-
1799  else if ((*i).second->isDirected().has_value() && !(*i).second->isDirected().value())
-
1800  {
-
1801  const UndirectedWeightedEdge<T> *udw_edge = dynamic_cast<const UndirectedWeightedEdge<T> *>((*i).second);
-
1802  weight = udw_edge->getWeight();
-
1803  }
-
1804  else
-
1805  {
-
1806  //ERROR it shouldn't never returned ( does not exist a Node Weighted and not Directed/Undirected)
-
1807  result.errorMessage = ERR_NO_DIR_OR_UNDIR_EDGE;
-
1808  return result;
-
1809  }
-
1810  }
-
1811  else
-
1812  {
-
1813  // No Weighted Edge
-
1814  result.errorMessage = ERR_NO_WEIGHTED_EDGE;
-
1815  return result;
-
1816  }
-
1817  auto u_i = std::find_if(dist.begin(), dist.end(), [u](std::pair<const Node<T> *, std::pair<long, const Node<T> *>> const &it)
-
1818  { return (*u == *(it.first)); });
-
1819 
-
1820  auto v_i = std::find_if(dist.begin(), dist.end(), [v](std::pair<const Node<T> *, std::pair<long, const Node<T> *>> const &it)
-
1821  { return (*v == *(it.first)); });
-
1822  long du = u_i->second.first;
-
1823  long dv = v_i->second.first;
-
1824 
-
1825  // If there is shorted path to v through u.
-
1826  if (dv > du + weight)
-
1827  {
-
1828  // If dv is not INF then it must be in B[dv]
-
1829  // bucket, so erase its entry using iterator
-
1830  // in O(1)
-
1831  if (dv != std::numeric_limits<long>::max())
-
1832  {
-
1833  auto findIter = std::find(B[dv].begin(), B[dv].end(), dist[v].second);
-
1834  B[dv].erase(findIter);
-
1835  }
-
1836 
-
1837  // updating the distance
-
1838  dist[v].first = du + weight;
-
1839  dv = dist[v].first;
-
1840 
-
1841  // pushing vertex v into updated distance's bucket
-
1842  B[dv].push_front(v);
-
1843 
-
1844  // storing updated iterator in dist[v].second
-
1845  dist[v].second = *(B[dv].begin());
-
1846  }
-
1847  }
-
1848  }
-
1849  for (auto dist_i : dist)
-
1850  {
-
1851  result.minDistanceMap[dist_i.first->getId()] = dist_i.second.first;
-
1852  }
-
1853  result.success = true;
-
1854 
-
1855  return result;
-
1856  }
-
1857 
-
1858  template <typename T>
-
1859  int Graph<T>::writeToFile(InputOutputFormat format, const std::string &workingDir, const std::string &OFileName, bool compress, bool writeNodeFeat, bool writeEdgeWeight) const
-
1860  {
-
1861  int result = 0;
-
1862  if (format == InputOutputFormat::STANDARD_CSV)
-
1863  {
-
1864  result = writeToStandardFile_csv(workingDir, OFileName, compress, writeNodeFeat, writeEdgeWeight);
-
1865  }
-
1866  else if (format == InputOutputFormat::STANDARD_TSV)
-
1867  {
-
1868  result = writeToStandardFile_tsv(workingDir, OFileName, compress, writeNodeFeat, writeEdgeWeight);
-
1869  }
-
1870  else
-
1871  {
-
1872  //OUTPUT FORMAT NOT RECOGNIZED
-
1873  return -1;
-
1874  }
-
1875  if (result == 0 && compress)
-
1876  {
-
1877  auto compress = [this, &workingDir, &OFileName, &writeNodeFeat, &writeEdgeWeight](const std::string &extension)
-
1878  {
-
1879  std::string completePathToFileGraph = workingDir + "/" + OFileName + extension;
-
1880  std::string completePathToFileGraphCompressed = workingDir + "/" + OFileName + extension + ".gz";
-
1881  int _result = compressFile(completePathToFileGraph, completePathToFileGraphCompressed);
-
1882  if (_result == 0)
-
1883  {
-
1884  _result = remove(completePathToFileGraph.c_str());
-
1885  }
-
1886  if (_result == 0)
-
1887  {
-
1888  if (writeNodeFeat)
-
1889  {
-
1890  std::string completePathToFileNodeFeat = workingDir + "/" + OFileName + "_NodeFeat" + extension;
-
1891  std::string completePathToFileNodeFeatCompressed = workingDir + "/" + OFileName + "_NodeFeat" + extension + ".gz";
-
1892  _result = compressFile(completePathToFileNodeFeat, completePathToFileNodeFeatCompressed);
-
1893  if (_result == 0)
-
1894  {
-
1895  _result = remove(completePathToFileNodeFeat.c_str());
-
1896  }
-
1897  }
-
1898  }
-
1899  if (_result == 0)
-
1900  {
-
1901  if (writeEdgeWeight)
-
1902  {
-
1903  std::string completePathToFileEdgeWeight = workingDir + "/" + OFileName + "_EdgeWeight" + extension;
-
1904  std::string completePathToFileEdgeWeightCompressed = workingDir + "/" + OFileName + "_EdgeWeight" + extension + ".gz";
-
1905  _result = compressFile(completePathToFileEdgeWeight, completePathToFileEdgeWeightCompressed);
-
1906  if (_result == 0)
-
1907  {
-
1908  _result = remove(completePathToFileEdgeWeight.c_str());
-
1909  }
-
1910  }
-
1911  }
-
1912  return _result;
-
1913  };
-
1914  if (format == InputOutputFormat::STANDARD_CSV)
-
1915  {
-
1916  auto result = compress(".csv");
-
1917  }
-
1918  else if (format == InputOutputFormat::STANDARD_TSV)
-
1919  {
-
1920  auto result = compress(".tsv");
-
1921  }
-
1922  else
-
1923  {
-
1924  //OUTPUT FORMAT NOT RECOGNIZED
-
1925  result = -1;
-
1926  }
-
1927  }
-
1928  return result;
-
1929  }
-
1930 
-
1931  template <typename T>
-
1932  int Graph<T>::readFromFile(InputOutputFormat format, const std::string &workingDir, const std::string &OFileName, bool compress, bool readNodeFeat, bool readEdgeWeight)
-
1933  {
-
1934  int result = 0;
-
1935  if (compress)
-
1936  {
-
1937  auto decompress = [this, &workingDir, &OFileName, &readNodeFeat, &readEdgeWeight](const std::string &extension)
-
1938  {
-
1939  std::string completePathToFileGraph = workingDir + "/" + OFileName + extension;
-
1940  std::string completePathToFileGraphCompressed = workingDir + "/" + OFileName + extension + ".gz";
-
1941  int _result = decompressFile(completePathToFileGraphCompressed, completePathToFileGraph);
-
1942  if (_result == 0)
-
1943  {
-
1944  if (readNodeFeat)
-
1945  {
-
1946  std::string completePathToFileNodeFeat = workingDir + "/" + OFileName + "_NodeFeat" + extension;
-
1947  std::string completePathToFileNodeFeatCompressed = workingDir + "/" + OFileName + "_NodeFeat" + extension + ".gz";
-
1948  _result = decompressFile(completePathToFileNodeFeatCompressed, completePathToFileNodeFeat);
-
1949  }
-
1950  }
-
1951  if (_result == 0)
-
1952  {
-
1953  if (readEdgeWeight)
-
1954  {
-
1955  std::string completePathToFileEdgeWeight = workingDir + "/" + OFileName + "_EdgeWeight" + extension;
-
1956  std::string completePathToFileEdgeWeightCompressed = workingDir + "/" + OFileName + "_EdgeWeight" + extension + ".gz";
-
1957  _result = decompressFile(completePathToFileEdgeWeightCompressed, completePathToFileEdgeWeight);
-
1958  }
-
1959  }
-
1960  return _result;
-
1961  };
-
1962  if (format == InputOutputFormat::STANDARD_CSV)
-
1963  {
-
1964  result = decompress(".csv");
-
1965  }
-
1966  else if (format == InputOutputFormat::STANDARD_TSV)
-
1967  {
-
1968  result = decompress(".tsv");
-
1969  }
-
1970  else
-
1971  {
-
1972  //OUTPUT FORMAT NOT RECOGNIZED
-
1973  result = -1;
-
1974  }
-
1975  }
-
1976  if (result == 0)
-
1977  {
-
1978  if (format == InputOutputFormat::STANDARD_CSV)
-
1979  {
-
1980  result = readFromStandardFile_csv(workingDir, OFileName, compress, readNodeFeat, readEdgeWeight);
-
1981  }
-
1982  else if (format == InputOutputFormat::STANDARD_TSV)
-
1983  {
-
1984  result = readFromStandardFile_tsv(workingDir, OFileName, compress, readNodeFeat, readEdgeWeight);
-
1985  }
-
1986  else
-
1987  {
-
1988  //OUTPUT FORMAT NOT RECOGNIZED
-
1989  result = -1;
-
1990  }
-
1991  }
-
1992  return result;
-
1993  }
-
1994 
-
1995  template <typename T>
-
1996  PartitionMap<T> Graph<T>::partitionGraph(PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const
-
1997  {
-
1998  PartitionMap<T> partitionMap;
-
1999  for (unsigned int i = 0; i < numberOfPartitions; ++i)
-
2000  {
-
2001  partitionMap[i] = new Partition<T>(i);
-
2002  }
-
2003  if (algorithm == PartitionAlgorithm::GREEDY_VC)
-
2004  {
-
2005  greedyPartition(partitionMap);
-
2006  }
-
2007  else
-
2008  {
-
2009  //Error not recognized algorithm
-
2010  partitionMap.clear();
-
2011  }
-
2012  return partitionMap;
-
2013  }
-
2014 
-
2016  template <typename T>
-
2017  class Graph_TS : public Graph<T>, public ThreadSafe
-
2018  {
-
2019  public:
-
2020  Graph_TS() = default;
-
2021  Graph_TS(const std::list<const Edge<T> *> &edgeSet);
-
2022  Graph_TS(const Graph<T> &graph);
-
2023  ~Graph_TS() = default;
-
2032  const std::list<const Edge<T> *> &getEdgeSet() const override;
-
2041  void setEdgeSet(std::list<const Edge<T> *> &edgeSet) override;
-
2050  void addEdge(const Edge<T> *edge) override;
-
2059  void removeEdge(unsigned long edgeId) override;
-
2068  const std::list<const Node<T> *> getNodeSet() const override;
-
2078  const std::optional<const Edge<T> *> getEdge(unsigned long edgeId) const override;
-
2084  const AdjacencyMatrix<T> getAdjMatrix() const override;
-
2097  const DijkstraResult dijkstra(const Node<T> &source, const Node<T> &target) const override;
-
2108  const std::vector<Node<T>> breadth_first_search(const Node<T> &start) const override;
-
2119  const std::vector<Node<T>> depth_first_search(const Node<T> &start) const override;
-
2120 
-
2129  bool isCyclicDirectedGraphDFS() const override;
-
2130 
-
2139  bool isCyclicDirectedGraphBFS() const override;
-
2140 
-
2148  bool isDirectedGraph() const override;
-
2149 
-
2176  const DialResult dial(const Node<T> &source, int maxWeight) const override;
-
2177 
-
2191  int writeToFile(typename Graph<T>::InputOutputFormat format = Graph<T>::InputOutputFormat::STANDARD_CSV, const std::string &workingDir = ".", const std::string &OFileName = "graph", bool compress = false, bool writeNodeFeat = false, bool writeEdgeWeight = false) const override;
-
2192 
-
2206  int readFromFile(typename Graph<T>::InputOutputFormat format = Graph<T>::InputOutputFormat::STANDARD_CSV, const std::string &workingDir = ".", const std::string &OFileName = "graph", bool compress = false, bool readNodeFeat = false, bool readEdgeWeight = false) override;
-
2207 
-
2217  PartitionMap<T> partitionGraph(typename Graph<T>::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const override;
-
2218  };
-
2219 
-
2220  template <typename T>
-
2221  Graph_TS<T>::Graph_TS(const std::list<const Edge<T> *> &edgeSet) : Graph<T>(edgeSet), ThreadSafe() {}
-
2222 
-
2223  template <typename T>
-
2224  Graph_TS<T>::Graph_TS(const Graph<T> &graph) : Graph<T>(graph), ThreadSafe() {}
-
2225 
-
2226  template <typename T>
-
2227  const std::list<const Edge<T> *> &Graph_TS<T>::getEdgeSet() const
-
2228  {
-
2229  std::lock_guard<std::mutex> lock(mutex);
-
2230  return Graph<T>::getEdgeSet();
-
2231  }
-
2232 
-
2233  template <typename T>
-
2234  void Graph_TS<T>::setEdgeSet(std::list<const Edge<T> *> &edgeSet)
-
2235  {
-
2236  getLock();
-
2237  Graph<T>::setEdgeSet(edgeSet);
-
2238  releaseLock();
-
2239  }
-
2240 
-
2241  template <typename T>
-
2242  void Graph_TS<T>::addEdge(const Edge<T> *edge)
-
2243  {
-
2244  getLock();
-
2245  Graph<T>::addEdge(edge);
-
2246  releaseLock();
-
2247  }
-
2248 
-
2249  template <typename T>
-
2250  void Graph_TS<T>::removeEdge(unsigned long edgeId)
-
2251  {
-
2252  getLock();
-
2253  Graph<T>::removeEdge(edgeId);
-
2254  releaseLock();
-
2255  }
-
2256 
-
2257  template <typename T>
-
2258  const std::list<const Node<T> *> Graph_TS<T>::getNodeSet() const
-
2259  {
-
2260  getLock();
-
2261  auto ns = Graph<T>::getNodeSet();
-
2262  releaseLock();
-
2263  return ns;
-
2264  }
-
2265 
-
2266  template <typename T>
-
2267  const std::optional<const Edge<T> *> Graph_TS<T>::getEdge(unsigned long edgeId) const
-
2268  {
-
2269  getLock();
-
2270  auto e = Graph<T>::getEdge(edgeId);
-
2271  releaseLock();
-
2272  return e;
-
2273  }
-
2274 
-
2275  template <typename T>
-
2276  const AdjacencyMatrix<T> Graph_TS<T>::getAdjMatrix() const
-
2277  {
-
2278  getLock();
-
2279  auto adjm = Graph<T>::getAdjMatrix();
-
2280  releaseLock();
-
2281  return adjm;
-
2282  }
-
2283 
-
2284  template <typename T>
-
2285  const DijkstraResult Graph_TS<T>::dijkstra(const Node<T> &source, const Node<T> &target) const
-
2286  {
-
2287  getLock();
-
2288  auto dij = Graph<T>::dijkstra(source, target);
-
2289  releaseLock();
-
2290  return dij;
-
2291  }
-
2292 
-
2293  template <typename T>
-
2294  const std::vector<Node<T>> Graph_TS<T>::breadth_first_search(const Node<T> &start) const
-
2295  {
-
2296  getLock();
-
2297  auto bfs = Graph<T>::breadth_first_search(start);
-
2298  releaseLock();
-
2299  return bfs;
-
2300  }
-
2301 
-
2302  template <typename T>
-
2303  const std::vector<Node<T>> Graph_TS<T>::depth_first_search(const Node<T> &start) const
-
2304  {
-
2305  getLock();
-
2306  auto dfs = Graph<T>::depth_first_search(start);
-
2307  releaseLock();
-
2308  return dfs;
-
2309  }
-
2310 
-
2311  template <typename T>
- -
2313  {
-
2314  getLock();
-
2315  auto result = Graph<T>::isCyclicDirectedGraphDFS();
-
2316  releaseLock();
-
2317  return result;
-
2318  }
-
2319 
-
2320  template <typename T>
- -
2322  {
-
2323  getLock();
-
2324  auto result = Graph<T>::isCyclicDirectedGraphBFS();
-
2325  releaseLock();
-
2326  return result;
-
2327  }
-
2328 
-
2329  template <typename T>
- -
2331  {
-
2332  getLock();
-
2333  auto result = Graph<T>::isDirectedGraph();
-
2334  releaseLock();
-
2335  return result;
-
2336  }
-
2337 
-
2338  template <typename T>
-
2339  const DialResult Graph_TS<T>::dial(const Node<T> &source, int maxWeight) const
-
2340  {
-
2341  getLock();
-
2342  auto dial = Graph<T>::dial(source, maxWeight);
-
2343  releaseLock();
-
2344  return dial;
-
2345  }
-
2346 
-
2347  template <typename T>
-
2348  int Graph_TS<T>::writeToFile(typename Graph<T>::InputOutputFormat format, const std::string &workingDir, const std::string &OFileName, bool compress, bool writeNodeFeat, bool writeEdgeWeight) const
-
2349  {
-
2350  getLock();
-
2351  auto result = Graph<T>::writeToFile(format, workingDir, OFileName, compress, writeNodeFeat, writeEdgeWeight);
-
2352  releaseLock();
-
2353  return result;
-
2354  }
-
2355 
-
2356  template <typename T>
-
2357  int Graph_TS<T>::readFromFile(typename Graph<T>::InputOutputFormat format, const std::string &workingDir, const std::string &OFileName, bool compress, bool readNodeFeat, bool readEdgeWeight)
-
2358  {
-
2359  getLock();
-
2360  auto result = Graph<T>::readFromFile(format, workingDir, OFileName, compress, readNodeFeat, readEdgeWeight);
-
2361  releaseLock();
-
2362  return result;
-
2363  }
-
2364 
-
2365  template <typename T>
-
2366  PartitionMap<T> Graph_TS<T>::partitionGraph(typename Graph<T>::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const
-
2367  {
-
2368  getLock();
-
2369  auto partitions = Graph<T>::partitionGraph(algorithm, numberOfPartitions);
-
2370  releaseLock();
-
2371  return partitions;
-
2372  }
-
2373 
-
2374  template <typename T>
-
2375  class Partition : public Graph<T>
-
2376  {
-
2377  public:
-
2378  Partition();
-
2379  Partition(unsigned int partitionId);
-
2380  Partition(const std::list<const Edge<T> *> &edgeSet);
-
2381  Partition(unsigned int partitionId, const std::list<const Edge<T> *> &edgeSet);
-
2382  ~Partition() = default;
-
2388  unsigned int getPartitionId() const;
-
2394  void setPartitionId(unsigned int partitionId);
-
2395 
-
2396  private:
-
2397  unsigned int partitionId;
-
2398  };
-
2399 
-
2407  template <typename T>
-
2408  static PartitioningStats getPartitionStats(const PartitionMap<T> &partitionMap);
-
2409 
-
2417  template <typename T>
-
2418  static unsigned int getMaxEdgesLoad(const PartitionMap<T> &partitionMap);
-
2419 
-
2427  template <typename T>
-
2428  static unsigned int getMinEdgesLoad(const PartitionMap<T> &partitionMap);
-
2429 
-
2437  template <typename T>
-
2438  static unsigned int getMaxNodesLoad(const PartitionMap<T> &partitionMap);
-
2439 
-
2447  template <typename T>
-
2448  static unsigned int getMinNodesLoad(const PartitionMap<T> &partitionMap);
-
2449 
-
2457  template <typename T>
-
2458  static unsigned int getNumberOfEdges(const PartitionMap<T> &partitionMap);
-
2459 
-
2467  template <typename T>
-
2468  static unsigned int getNumberOfNodes(const PartitionMap<T> &partitionMap);
-
2469 
-
2477  template <typename T>
-
2478  static unsigned int getNumberOfReplicatedEdges(const PartitionMap<T> &partitionMap);
-
2479 
-
2487  template <typename T>
-
2488  static unsigned int getNumberOfReplicatedNodes(const PartitionMap<T> &partitionMap);
-
2489 
-
2490  template <typename T>
- -
2492  {
-
2493  partitionId = 0;
-
2494  }
-
2495 
-
2496  template <typename T>
-
2497  Partition<T>::Partition(unsigned int partitionId) : Graph<T>()
-
2498  {
-
2499  this->partitionId = partitionId;
-
2500  }
-
2501 
-
2502  template <typename T>
-
2503  Partition<T>::Partition(const std::list<const Edge<T> *> &edgeSet) : Graph<T>(edgeSet)
-
2504  {
-
2505  partitionId = 0;
-
2506  }
-
2507 
-
2508  template <typename T>
-
2509  Partition<T>::Partition(unsigned int partitionId, const std::list<const Edge<T> *> &edgeSet) : Graph<T>(edgeSet)
-
2510  {
-
2511  this->partitionId = partitionId;
-
2512  }
-
2513 
-
2514  template <typename T>
-
2515  unsigned int Partition<T>::getPartitionId() const
-
2516  {
-
2517  return partitionId;
-
2518  }
-
2519 
-
2520  template <typename T>
-
2521  void Partition<T>::setPartitionId(unsigned int partitionId)
-
2522  {
-
2523  this->partitionId = partitionId;
-
2524  }
-
2525 
-
2526  template <typename T>
-
2527  PartitioningStats getPartitionStats(const PartitionMap<T> &partitionMap)
-
2528  {
-
2529  PartitioningStats result;
-
2530  result.numberOfPartitions = partitionMap.size();
-
2531  result.numberOfNodes = getNumberOfNodes(partitionMap);
-
2532  result.numberOfEdges = getNumberOfEdges(partitionMap);
-
2533  result.replicatedNodesCount = getNumberOfReplicatedNodes(partitionMap);
-
2534  result.replicatedEdgesCount = getNumberOfReplicatedEdges(partitionMap);
-
2535  result.maxEdgesLoad = getMaxEdgesLoad(partitionMap);
-
2536  result.minEdgesLoad = getMinEdgesLoad(partitionMap);
-
2537  result.maxNodesLoad = getMaxNodesLoad(partitionMap);
-
2538  result.minNodesLoad = getMinNodesLoad(partitionMap);
-
2539  result.edgesReplicationFactor = (double)result.replicatedEdgesCount / result.numberOfEdges;
-
2540  result.nodesReplicationFactor = (double)result.replicatedNodesCount / result.numberOfNodes;
-
2541  result.balanceEdgesFactor = (double)(result.maxEdgesLoad - result.minEdgesLoad) / (result.maxEdgesLoad);
-
2542  result.balanceNodesFactor = (double)(result.maxNodesLoad - result.minNodesLoad) / (result.maxNodesLoad);
-
2543  return result;
-
2544  }
-
2545 
-
2546  template <typename T>
-
2547  unsigned int getMaxEdgesLoad(const PartitionMap<T> &partitionMap)
-
2548  {
-
2549  unsigned int maxLoad = 0;
-
2550  for (auto it = partitionMap.begin(); it != partitionMap.end(); ++it)
-
2551  {
-
2552  if (it->second->getEdgeSet().size() > maxLoad)
-
2553  {
-
2554  maxLoad = it->second->getEdgeSet().size();
-
2555  }
-
2556  }
-
2557  return maxLoad;
-
2558  }
-
2559 
-
2560  template <typename T>
-
2561  unsigned int getMinEdgesLoad(const PartitionMap<T> &partitionMap)
-
2562  {
-
2563  unsigned int minLoad = std::numeric_limits<unsigned int>::max();
-
2564  for (auto it = partitionMap.begin(); it != partitionMap.end(); ++it)
-
2565  {
-
2566  if (it->second->getEdgeSet().size() < minLoad)
-
2567  {
-
2568  minLoad = it->second->getEdgeSet().size();
-
2569  }
-
2570  }
-
2571  return minLoad;
-
2572  }
-
2573 
-
2574  template <typename T>
-
2575  unsigned int getMaxNodesLoad(const PartitionMap<T> &partitionMap)
-
2576  {
-
2577  unsigned int maxLoad = 0;
-
2578  for (auto it = partitionMap.begin(); it != partitionMap.end(); ++it)
-
2579  {
-
2580  if (it->second->getNodeSet().size() > maxLoad)
-
2581  {
-
2582  maxLoad = it->second->getNodeSet().size();
-
2583  }
-
2584  }
-
2585  return maxLoad;
-
2586  }
-
2587 
-
2588  template <typename T>
-
2589  unsigned int getMinNodesLoad(const PartitionMap<T> &partitionMap)
-
2590  {
-
2591  unsigned int minLoad = std::numeric_limits<unsigned int>::max();
-
2592  for (auto it = partitionMap.begin(); it != partitionMap.end(); ++it)
-
2593  {
-
2594  if (it->second->getNodeSet().size() < minLoad)
-
2595  {
-
2596  minLoad = it->second->getNodeSet().size();
-
2597  }
-
2598  }
-
2599  return minLoad;
-
2600  }
-
2601 
-
2602  template <typename T>
-
2603  unsigned int getNumberOfEdges(const PartitionMap<T> &partitionMap)
-
2604  {
-
2605  unsigned int numberOfEdges = 0;
-
2606  std::list<const Edge<T> *> edgeSet;
-
2607 
-
2608  for (auto it = partitionMap.begin(); it != partitionMap.end(); ++it)
-
2609  {
-
2610  const std::list<const Edge<T> *> partitionEdgeSet = it->second->getEdgeSet();
-
2611  for (auto it2 = partitionEdgeSet.begin(); it2 != partitionEdgeSet.end(); ++it2)
-
2612  {
-
2613  if (std::find_if(edgeSet.begin(), edgeSet.end(), [it2](const Edge<T> *edge)
-
2614  { return (*(*it2) == *edge); }) == edgeSet.end())
-
2615  {
-
2616  edgeSet.push_back(*it2);
-
2617  }
-
2618  }
-
2619  }
-
2620 
-
2621  return edgeSet.size();
-
2622  }
-
2623 
-
2624  template <typename T>
-
2625  unsigned int getNumberOfNodes(const PartitionMap<T> &partitionMap)
-
2626  {
-
2627  unsigned int numberOfNodes = 0;
-
2628  std::list<const Node<T> *> nodeSet;
-
2629 
-
2630  for (auto it = partitionMap.begin(); it != partitionMap.end(); ++it)
-
2631  {
-
2632  const std::list<const Node<T> *> partitionNodeSet = it->second->getNodeSet();
-
2633  for (auto it2 = partitionNodeSet.begin(); it2 != partitionNodeSet.end(); ++it2)
-
2634  {
-
2635  if (std::find_if(nodeSet.begin(), nodeSet.end(), [it2](const Node<T> *node)
-
2636  { return (*(*it2) == *node); }) == nodeSet.end())
-
2637  {
-
2638  nodeSet.push_back(*it2);
-
2639  }
-
2640  }
-
2641  }
-
2642 
-
2643  return nodeSet.size();
-
2644  }
-
2645 
-
2646  template <typename T>
-
2647  unsigned int getNumberOfReplicatedEdges(const PartitionMap<T> &partitionMap)
-
2648  {
-
2649 
-
2650  unsigned int numberOfEdges = 0;
-
2651  for (auto it = partitionMap.begin(); it != partitionMap.end(); ++it)
-
2652  {
-
2653  numberOfEdges += it->second->getEdgeSet().size();
-
2654  }
-
2655  return numberOfEdges;
-
2656  }
-
2657 
-
2658  template <typename T>
-
2659  unsigned int getNumberOfReplicatedNodes(const PartitionMap<T> &partitionMap)
-
2660  {
-
2661  unsigned int numberOfNodes = 0;
-
2662  for (auto it = partitionMap.begin(); it != partitionMap.end(); ++it)
-
2663  {
-
2664  numberOfNodes += it->second->getNodeSet().size();
-
2665  }
-
2666  return numberOfNodes;
-
2667  }
-
2668 
-
2673  template <typename T>
-
2674  class Writer
-
2675  {
-
2676  public:
-
2686  virtual int writeGraph(const Graph<T> &graph, std::ofstream &file) = 0;
-
2687  };
-
2688 
-
2692  template <typename T>
-
2693  class Reader
-
2694  {
-
2704  virtual int ReadGraph(Graph<T> &graph, std::ifstream &file) = 0;
-
2705  };
-
2706 
-
2707  //ostream overload
-
2708  template <typename T>
-
2709  std::ostream &
-
2710  operator<<(std::ostream &os, const Node<T> &node)
-
2711  {
-
2712  os << "Node: {\n"
-
2713  << " Id:\t" << node.id << "\n Data:\t" << node.data << "\n}";
-
2714  return os;
-
2715  }
-
2716 
-
2717  template <typename T>
-
2718  std::ostream &operator<<(std::ostream &os, const Edge<T> &edge)
-
2719  {
-
2720  os << "((Node: " << edge.nodePair.first->getId() << ")) ?----- |Edge: " << edge.id << "|-----? ((Node: " << edge.nodePair.second->getId() << "))";
-
2721  return os;
-
2722  }
-
2723 
-
2724  template <typename T>
-
2725  std::ostream &operator<<(std::ostream &os, const DirectedEdge<T> &edge)
-
2726  {
-
2727  os << "((Node: " << edge.getFrom().getId() << ")) +----- |Edge: #" << edge.getId() << "|-----> ((Node: " << edge.getTo().getId() << "))";
-
2728  return os;
-
2729  }
-
2730 
-
2731  template <typename T>
-
2732  std::ostream &operator<<(std::ostream &os, const UndirectedEdge<T> &edge)
-
2733  {
-
2734  os << "((Node: " << edge.getNode1().getId() << ")) <----- |Edge: #" << edge.getId() << "|-----> ((Node: " << edge.getNode2().getId() << "))";
-
2735  return os;
-
2736  }
-
2737 
-
2738  template <typename T>
-
2739  std::ostream &operator<<(std::ostream &os, const DirectedWeightedEdge<T> &edge)
-
2740  {
-
2741  os << "((Node: " << edge.getFrom().getId() << ")) +----- |Edge: #" << edge.getId() << " W:" << edge.getWeight() << "|-----> ((Node: " << edge.getTo().getId() << "))";
-
2742  return os;
-
2743  }
-
2744 
-
2745  template <typename T>
-
2746  std::ostream &operator<<(std::ostream &os, const UndirectedWeightedEdge<T> &edge)
-
2747  {
-
2748  os << "((Node: " << edge.getNode1().getId() << ")) <----- |Edge: #" << edge.getId() << " W:" << edge.getWeight() << "|-----> ((Node: " << edge.getNode2().getId() << "))";
-
2749  return os;
-
2750  }
-
2751 
-
2752  template <typename T>
-
2753  std::ostream &operator<<(std::ostream &os, const AdjacencyMatrix<T> &adj)
-
2754  {
-
2755  os << "Adjacency Matrix:\n";
-
2756  auto it = adj.begin();
-
2757  unsigned long max_column = 0;
-
2758  for (it; it != adj.end(); ++it)
-
2759  {
-
2760  if (it->second.size() > max_column)
-
2761  {
-
2762  max_column = it->second.size();
-
2763  }
-
2764  }
-
2765  if (max_column == 0)
-
2766  {
-
2767  os << "ERROR in Print\n";
-
2768  return os;
-
2769  }
-
2770  else
-
2771  {
-
2772  it = adj.begin();
-
2773  os << "|--|";
-
2774  for (int i = 0; i < max_column; i++)
-
2775  {
-
2776  os << "-----|";
-
2777  }
-
2778  os << "\n";
-
2779  for (it; it != adj.end(); ++it)
-
2780  {
-
2781  os << "|N" << it->first->getId() << "|";
-
2782  auto it2 = it->second.begin();
-
2783  for (it2; it2 != it->second.end(); ++it2)
-
2784  {
-
2785  os << "N" << it2->first->getId() << ",E" << it2->second->getId() << "|";
-
2786  }
-
2787  os << "\n|--|";
-
2788  for (int i = 0; i < max_column; i++)
-
2789  {
-
2790  os << "-----|";
-
2791  }
-
2792  os << "\n";
-
2793  }
-
2794  }
-
2795  return os;
-
2796  }
-
2797 
-
2798 } // namespace CXXGRAPH
-
2799 #endif // __CXXGRAPH_H__
-
Definition: Graph.hpp:335
-
Definition: Graph.hpp:449
-
Definition: Graph.hpp:263
-
Class that implement the Thread Safe Graph.
Definition: Graph.hpp:2018
-
const std::optional< const Edge< T > * > getEdge(unsigned long edgeId) const override
Function that return an Edge with specific ID if Exist in the Graph Note: Thread Safe.
Definition: Graph.hpp:2267
-
const std::list< const Node< T > * > getNodeSet() const override
Function that return the Node Set of the Graph Note: Thread Safe.
Definition: Graph.hpp:2258
-
void setEdgeSet(std::list< const Edge< T > * > &edgeSet) override
Function set the Edge Set of the Graph Note: Thread Safe.
Definition: Graph.hpp:2234
-
bool isDirectedGraph() const override
This function checks if a graph is directed Note: Thread Safe.
Definition: Graph.hpp:2330
-
const DijkstraResult dijkstra(const Node< T > &source, const Node< T > &target) const override
Function runs the dijkstra algorithm for some source node and target node in the graph and returns th...
Definition: Graph.hpp:2285
-
int writeToFile(typename Graph< T >::InputOutputFormat format=Graph< T >::InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) const override
This function write the graph in an output file Note: Thread Safe.
Definition: Graph.hpp:2348
-
void addEdge(const Edge< T > *edge) override
Function add an Edge to the Graph Edge Set Note: Thread Safe.
Definition: Graph.hpp:2242
-
PartitionMap< T > partitionGraph(typename Graph< T >::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const override
This function partition a graph in a set of partitions Note: Thread Safe.
Definition: Graph.hpp:2366
-
bool isCyclicDirectedGraphBFS() const override
This function uses BFS to check for cycle in the graph. Pay Attention, this function work only with d...
Definition: Graph.hpp:2321
-
const std::vector< Node< T > > breadth_first_search(const Node< T > &start) const override
Function performs the breadth first search algorithm over the graph Note: Thread Safe.
Definition: Graph.hpp:2294
-
void removeEdge(unsigned long edgeId) override
Function remove an Edge from the Graph Edge Set Note: Thread Safe.
Definition: Graph.hpp:2250
-
const std::list< const Edge< T > * > & getEdgeSet() const override
Function that return the Edge set of the Graph Note: Thread Safe.
Definition: Graph.hpp:2227
-
const std::vector< Node< T > > depth_first_search(const Node< T > &start) const override
Function performs the depth first search algorithm over the graph Note: Thread Safe.
Definition: Graph.hpp:2303
-
int readFromFile(typename Graph< T >::InputOutputFormat format=Graph< T >::InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool readNodeFeat=false, bool readEdgeWeight=false) override
This function read the graph from an input file Note: Thread Safe.
Definition: Graph.hpp:2357
-
const DialResult dial(const Node< T > &source, int maxWeight) const override
This function write the graph in an output file Note: Thread Safe.
Definition: Graph.hpp:2339
-
bool isCyclicDirectedGraphDFS() const override
This function uses DFS to check for cycle in the graph. Pay Attention, this function work only with d...
Definition: Graph.hpp:2312
-
const AdjacencyMatrix< T > getAdjMatrix() const override
This function generate a list of adjacency matrix with every element of the matrix contain the node w...
Definition: Graph.hpp:2276
-
Class that implement the Graph. ( This class is not Thread Safe )
Definition: Graph.hpp:573
-
virtual const std::vector< Node< T > > depth_first_search(const Node< T > &start) const
Function performs the depth first search algorithm over the graph Note: No Thread Safe.
Definition: Graph.hpp:1524
-
E_PartitionAlgorithm
Specify the Partition Algorithm.
Definition: Graph.hpp:600
-
@ GREEDY_VC
A Greedy Vertex-Cut Algorithm.
Definition: Graph.hpp:601
-
virtual const std::list< const Edge< T > * > & getEdgeSet() const
Function that return the Edge set of the Graph Note: No Thread Safe.
Definition: Graph.hpp:823
-
virtual const std::optional< const Edge< T > * > getEdge(unsigned long edgeId) const
Function that return an Edge with specific ID if Exist in the Graph Note: No Thread Safe.
Definition: Graph.hpp:884
-
virtual bool isCyclicDirectedGraphBFS() const
This function uses BFS to check for cycle in the graph. Pay Attention, this function work only with d...
Definition: Graph.hpp:1646
-
virtual void removeEdge(unsigned long edgeId)
Function remove an Edge from the Graph Edge Set Note: No Thread Safe.
Definition: Graph.hpp:853
-
virtual int writeToFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) const
This function write the graph in an output file Note: No Thread Safe.
Definition: Graph.hpp:1859
-
virtual bool isDirectedGraph() const
This function checks if a graph is directed Note: No Thread Safe.
Definition: Graph.hpp:1715
-
virtual const DialResult dial(const Node< T > &source, int maxWeight) const
This function write the graph in an output file Note: No Thread Safe.
Definition: Graph.hpp:1731
-
virtual const DijkstraResult dijkstra(const Node< T > &source, const Node< T > &target) const
Function runs the dijkstra algorithm for some source node and target node in the graph and returns th...
Definition: Graph.hpp:1374
-
virtual bool isCyclicDirectedGraphDFS() const
This function uses DFS to check for cycle in the graph. Pay Attention, this function work only with d...
Definition: Graph.hpp:1556
-
virtual void addEdge(const Edge< T > *edge)
Function add an Edge to the Graph Edge Set Note: No Thread Safe.
Definition: Graph.hpp:843
-
virtual PartitionMap< T > partitionGraph(PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const
This function partition a graph in a set of partitions Note: No Thread Safe.
Definition: Graph.hpp:1996
-
virtual int readFromFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool readNodeFeat=false, bool readEdgeWeight=false)
This function read the graph from an input file Note: No Thread Safe.
Definition: Graph.hpp:1932
-
virtual const AdjacencyMatrix< T > getAdjMatrix() const
This function generate a list of adjacency matrix with every element of the matrix contain the node w...
Definition: Graph.hpp:1347
-
virtual const std::list< const Node< T > * > getNodeSet() const
Function that return the Node Set of the Graph Note: No Thread Safe.
Definition: Graph.hpp:864
-
virtual const std::vector< Node< T > > breadth_first_search(const Node< T > &start) const
Function performs the breadth first search algorithm over the graph Note: No Thread Safe.
Definition: Graph.hpp:1484
-
virtual void setEdgeSet(std::list< const Edge< T > * > &edgeSet)
Function set the Edge Set of the Graph Note: No Thread Safe.
Definition: Graph.hpp:829
-
E_InputOutputFormat
Specify the Input/Output format of the Graph for Import/Export functions.
Definition: Graph.hpp:589
-
@ STANDARD_CSV
A standard csv format.
Definition: Graph.hpp:590
-
@ STANDARD_TSV
A standard tsv format.
Definition: Graph.hpp:591
-
Definition: Graph.hpp:157
-
Definition: Graph.hpp:2376
-
void setPartitionId(unsigned int partitionId)
Set the Partition ID.
Definition: Graph.hpp:2521
-
unsigned int getPartitionId() const
Get the Partition ID.
Definition: Graph.hpp:2515
-
Definition: Graph.hpp:2694
-
Definition: Graph.hpp:242
-
Definition: Graph.hpp:392
-
Definition: Graph.hpp:509
-
Definition: Graph.hpp:205
-
Definition: Graph.hpp:2675
-
virtual int writeGraph(const Graph< T > &graph, std::ofstream &file)=0
Function performs the writing of the Graph to the file.
-
Struct that contains the information about Dijsktra's Algorithm results.
Definition: Graph.hpp:88
-
Struct that contains the information about Dijsktra's Algorithm results.
Definition: Graph.hpp:79
-
Struct that contains the information about the partitioning statistics.
Definition: Graph.hpp:97
+
1555 } // namespace CXXGRAPH
+
1556 #endif // __GRAPH_H__
+
Definition: DirectedEdge.hpp:39
+
Definition: DirectedWeightedEdge.hpp:42
+
Definition: Edge.hpp:40
+
Class that implement the Graph. ( This class is not Thread Safe )
Definition: Graph.hpp:76
+
virtual const std::vector< Node< T > > depth_first_search(const Node< T > &start) const
Function performs the depth first search algorithm over the graph Note: No Thread Safe.
Definition: Graph.hpp:1013
+
virtual const std::list< const Edge< T > * > & getEdgeSet() const
Function that return the Edge set of the Graph Note: No Thread Safe.
Definition: Graph.hpp:307
+
virtual const std::optional< const Edge< T > * > getEdge(unsigned long edgeId) const
Function that return an Edge with specific ID if Exist in the Graph Note: No Thread Safe.
Definition: Graph.hpp:368
+
virtual bool isCyclicDirectedGraphBFS() const
This function uses BFS to check for cycle in the graph. Pay Attention, this function work only with d...
Definition: Graph.hpp:1135
+
virtual void removeEdge(unsigned long edgeId)
Function remove an Edge from the Graph Edge Set Note: No Thread Safe.
Definition: Graph.hpp:337
+
virtual int writeToFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool writeNodeFeat=false, bool writeEdgeWeight=false) const
This function write the graph in an output file Note: No Thread Safe.
Definition: Graph.hpp:1348
+
virtual bool isDirectedGraph() const
This function checks if a graph is directed Note: No Thread Safe.
Definition: Graph.hpp:1204
+
virtual const DialResult dial(const Node< T > &source, int maxWeight) const
This function write the graph in an output file Note: No Thread Safe.
Definition: Graph.hpp:1220
+
virtual const DijkstraResult dijkstra(const Node< T > &source, const Node< T > &target) const
Function runs the dijkstra algorithm for some source node and target node in the graph and returns th...
Definition: Graph.hpp:863
+
virtual bool isCyclicDirectedGraphDFS() const
This function uses DFS to check for cycle in the graph. Pay Attention, this function work only with d...
Definition: Graph.hpp:1045
+
virtual void addEdge(const Edge< T > *edge)
Function add an Edge to the Graph Edge Set Note: No Thread Safe.
Definition: Graph.hpp:327
+
virtual PartitionMap< T > partitionGraph(PARTITIONING::PartitionAlgorithm algorithm, unsigned int numberOfPartitions) const
This function partition a graph in a set of partitions Note: No Thread Safe.
Definition: Graph.hpp:1485
+
virtual int readFromFile(InputOutputFormat format=InputOutputFormat::STANDARD_CSV, const std::string &workingDir=".", const std::string &OFileName="graph", bool compress=false, bool readNodeFeat=false, bool readEdgeWeight=false)
This function read the graph from an input file Note: No Thread Safe.
Definition: Graph.hpp:1421
+
virtual const AdjacencyMatrix< T > getAdjMatrix() const
This function generate a list of adjacency matrix with every element of the matrix contain the node w...
Definition: Graph.hpp:836
+
virtual const std::list< const Node< T > * > getNodeSet() const
Function that return the Node Set of the Graph Note: No Thread Safe.
Definition: Graph.hpp:348
+
virtual const std::vector< Node< T > > breadth_first_search(const Node< T > &start) const
Function performs the breadth first search algorithm over the graph Note: No Thread Safe.
Definition: Graph.hpp:973
+
virtual void setEdgeSet(std::list< const Edge< T > * > &edgeSet)
Function set the Edge Set of the Graph Note: No Thread Safe.
Definition: Graph.hpp:313
+
Definition: Node.hpp:35
+
Definition: Partition.hpp:38
+
Definition: UndirectedEdge.hpp:39
+
Definition: UndirectedWeightedEdge.hpp:43
+
Struct that contains the information about Dijsktra's Algorithm results.
Definition: Typedef.hpp:71
+
Struct that contains the information about Dijsktra's Algorithm results.
Definition: Typedef.hpp:62