788 |
788 |
789 /// \brief Destructor of the GraphCopy |
789 /// \brief Destructor of the GraphCopy |
790 /// |
790 /// |
791 /// Destructor of the GraphCopy |
791 /// Destructor of the GraphCopy |
792 ~GraphCopy() { |
792 ~GraphCopy() { |
793 for (int i = 0; i < (int)nodeMapCopies.size(); ++i) { |
793 for (int i = 0; i < int(nodeMapCopies.size()); ++i) { |
794 delete nodeMapCopies[i]; |
794 delete nodeMapCopies[i]; |
795 } |
795 } |
796 for (int i = 0; i < (int)edgeMapCopies.size(); ++i) { |
796 for (int i = 0; i < int(edgeMapCopies.size()); ++i) { |
797 delete edgeMapCopies[i]; |
797 delete edgeMapCopies[i]; |
798 } |
798 } |
799 |
799 |
800 } |
800 } |
801 |
801 |
834 } |
834 } |
835 |
835 |
836 /// \brief Make a copy of the given node. |
836 /// \brief Make a copy of the given node. |
837 /// |
837 /// |
838 /// Make a copy of the given node. |
838 /// Make a copy of the given node. |
839 GraphCopy& node(TNode& tnode, const Node& node) { |
839 GraphCopy& node(TNode& tnode, const Node& snode) { |
840 nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Node, |
840 nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Node, |
841 NodeRefMap, TNode>(tnode, node)); |
841 NodeRefMap, TNode>(tnode, snode)); |
842 return *this; |
842 return *this; |
843 } |
843 } |
844 |
844 |
845 /// \brief Copies the edge references into the given map. |
845 /// \brief Copies the edge references into the given map. |
846 /// |
846 /// |
877 } |
877 } |
878 |
878 |
879 /// \brief Make a copy of the given edge. |
879 /// \brief Make a copy of the given edge. |
880 /// |
880 /// |
881 /// Make a copy of the given edge. |
881 /// Make a copy of the given edge. |
882 GraphCopy& edge(TEdge& tedge, const Edge& edge) { |
882 GraphCopy& edge(TEdge& tedge, const Edge& sedge) { |
883 edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Edge, |
883 edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Edge, |
884 EdgeRefMap, TEdge>(tedge, edge)); |
884 EdgeRefMap, TEdge>(tedge, sedge)); |
885 return *this; |
885 return *this; |
886 } |
886 } |
887 |
887 |
888 /// \brief Executes the copies. |
888 /// \brief Executes the copies. |
889 /// |
889 /// |
891 void run() { |
891 void run() { |
892 NodeRefMap nodeRefMap(source); |
892 NodeRefMap nodeRefMap(source); |
893 EdgeRefMap edgeRefMap(source); |
893 EdgeRefMap edgeRefMap(source); |
894 _graph_utils_bits::GraphCopySelector<Target>:: |
894 _graph_utils_bits::GraphCopySelector<Target>:: |
895 copy(target, source, nodeRefMap, edgeRefMap); |
895 copy(target, source, nodeRefMap, edgeRefMap); |
896 for (int i = 0; i < (int)nodeMapCopies.size(); ++i) { |
896 for (int i = 0; i < int(nodeMapCopies.size()); ++i) { |
897 nodeMapCopies[i]->copy(source, nodeRefMap); |
897 nodeMapCopies[i]->copy(source, nodeRefMap); |
898 } |
898 } |
899 for (int i = 0; i < (int)edgeMapCopies.size(); ++i) { |
899 for (int i = 0; i < int(edgeMapCopies.size()); ++i) { |
900 edgeMapCopies[i]->copy(source, edgeRefMap); |
900 edgeMapCopies[i]->copy(source, edgeRefMap); |
901 } |
901 } |
902 } |
902 } |
903 |
903 |
904 protected: |
904 protected: |
965 |
965 |
966 typedef typename Source::Edge Key; |
966 typedef typename Source::Edge Key; |
967 typedef typename Target::Edge Value; |
967 typedef typename Target::Edge Value; |
968 |
968 |
969 Value operator[](const Key& key) const { |
969 Value operator[](const Key& key) const { |
970 bool forward = (source.direction(key) == |
970 bool forward = |
971 (node_ref[source.source((UEdge)key)] == |
971 (source.direction(key) == |
972 target.source(uedge_ref[(UEdge)key]))); |
972 (node_ref[source.source(static_cast<const UEdge&>(key))] == |
|
973 target.source(uedge_ref[static_cast<const UEdge&>(key)]))); |
973 return target.direct(uedge_ref[key], forward); |
974 return target.direct(uedge_ref[key], forward); |
974 } |
975 } |
975 |
976 |
976 const Target& target; |
977 const Target& target; |
977 const Source& source; |
978 const Source& source; |
992 |
993 |
993 /// \brief Destructor of the GraphCopy |
994 /// \brief Destructor of the GraphCopy |
994 /// |
995 /// |
995 /// Destructor of the GraphCopy |
996 /// Destructor of the GraphCopy |
996 ~UGraphCopy() { |
997 ~UGraphCopy() { |
997 for (int i = 0; i < (int)nodeMapCopies.size(); ++i) { |
998 for (int i = 0; i < int(nodeMapCopies.size()); ++i) { |
998 delete nodeMapCopies[i]; |
999 delete nodeMapCopies[i]; |
999 } |
1000 } |
1000 for (int i = 0; i < (int)edgeMapCopies.size(); ++i) { |
1001 for (int i = 0; i < int(edgeMapCopies.size()); ++i) { |
1001 delete edgeMapCopies[i]; |
1002 delete edgeMapCopies[i]; |
1002 } |
1003 } |
1003 for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) { |
1004 for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) { |
1004 delete uEdgeMapCopies[i]; |
1005 delete uEdgeMapCopies[i]; |
1005 } |
1006 } |
1006 |
1007 |
1007 } |
1008 } |
1008 |
1009 |
1041 } |
1042 } |
1042 |
1043 |
1043 /// \brief Make a copy of the given node. |
1044 /// \brief Make a copy of the given node. |
1044 /// |
1045 /// |
1045 /// Make a copy of the given node. |
1046 /// Make a copy of the given node. |
1046 UGraphCopy& node(TNode& tnode, const Node& node) { |
1047 UGraphCopy& node(TNode& tnode, const Node& snode) { |
1047 nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Node, |
1048 nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Node, |
1048 NodeRefMap, TNode>(tnode, node)); |
1049 NodeRefMap, TNode>(tnode, snode)); |
1049 return *this; |
1050 return *this; |
1050 } |
1051 } |
1051 |
1052 |
1052 /// \brief Copies the edge references into the given map. |
1053 /// \brief Copies the edge references into the given map. |
1053 /// |
1054 /// |
1084 } |
1085 } |
1085 |
1086 |
1086 /// \brief Make a copy of the given edge. |
1087 /// \brief Make a copy of the given edge. |
1087 /// |
1088 /// |
1088 /// Make a copy of the given edge. |
1089 /// Make a copy of the given edge. |
1089 UGraphCopy& edge(TEdge& tedge, const Edge& edge) { |
1090 UGraphCopy& edge(TEdge& tedge, const Edge& sedge) { |
1090 edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Edge, |
1091 edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Edge, |
1091 EdgeRefMap, TEdge>(tedge, edge)); |
1092 EdgeRefMap, TEdge>(tedge, sedge)); |
1092 return *this; |
1093 return *this; |
1093 } |
1094 } |
1094 |
1095 |
1095 /// \brief Copies the undirected edge references into the given map. |
1096 /// \brief Copies the undirected edge references into the given map. |
1096 /// |
1097 /// |
1127 } |
1128 } |
1128 |
1129 |
1129 /// \brief Make a copy of the given undirected edge. |
1130 /// \brief Make a copy of the given undirected edge. |
1130 /// |
1131 /// |
1131 /// Make a copy of the given undirected edge. |
1132 /// Make a copy of the given undirected edge. |
1132 UGraphCopy& uEdge(TUEdge& tuedge, const UEdge& uedge) { |
1133 UGraphCopy& uEdge(TUEdge& tuedge, const UEdge& suedge) { |
1133 uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, UEdge, |
1134 uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, UEdge, |
1134 UEdgeRefMap, TUEdge>(tuedge, uedge)); |
1135 UEdgeRefMap, TUEdge>(tuedge, suedge)); |
1135 return *this; |
1136 return *this; |
1136 } |
1137 } |
1137 |
1138 |
1138 /// \brief Executes the copies. |
1139 /// \brief Executes the copies. |
1139 /// |
1140 /// |
1142 NodeRefMap nodeRefMap(source); |
1143 NodeRefMap nodeRefMap(source); |
1143 UEdgeRefMap uEdgeRefMap(source); |
1144 UEdgeRefMap uEdgeRefMap(source); |
1144 EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap); |
1145 EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap); |
1145 _graph_utils_bits::UGraphCopySelector<Target>:: |
1146 _graph_utils_bits::UGraphCopySelector<Target>:: |
1146 copy(target, source, nodeRefMap, uEdgeRefMap); |
1147 copy(target, source, nodeRefMap, uEdgeRefMap); |
1147 for (int i = 0; i < (int)nodeMapCopies.size(); ++i) { |
1148 for (int i = 0; i < int(nodeMapCopies.size()); ++i) { |
1148 nodeMapCopies[i]->copy(source, nodeRefMap); |
1149 nodeMapCopies[i]->copy(source, nodeRefMap); |
1149 } |
1150 } |
1150 for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) { |
1151 for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) { |
1151 uEdgeMapCopies[i]->copy(source, uEdgeRefMap); |
1152 uEdgeMapCopies[i]->copy(source, uEdgeRefMap); |
1152 } |
1153 } |
1153 for (int i = 0; i < (int)edgeMapCopies.size(); ++i) { |
1154 for (int i = 0; i < int(edgeMapCopies.size()); ++i) { |
1154 edgeMapCopies[i]->copy(source, edgeRefMap); |
1155 edgeMapCopies[i]->copy(source, edgeRefMap); |
1155 } |
1156 } |
1156 } |
1157 } |
1157 |
1158 |
1158 private: |
1159 private: |
1243 |
1244 |
1244 typedef typename Source::Edge Key; |
1245 typedef typename Source::Edge Key; |
1245 typedef typename Target::Edge Value; |
1246 typedef typename Target::Edge Value; |
1246 |
1247 |
1247 Value operator[](const Key& key) const { |
1248 Value operator[](const Key& key) const { |
1248 bool forward = (source.direction(key) == |
1249 bool forward = |
1249 (node_ref[source.source((UEdge)key)] == |
1250 (source.direction(key) == |
1250 target.source(uedge_ref[(UEdge)key]))); |
1251 (node_ref[source.source(static_cast<const UEdge&>(key))] == |
|
1252 target.source(uedge_ref[static_cast<const UEdge&>(key)]))); |
1251 return target.direct(uedge_ref[key], forward); |
1253 return target.direct(uedge_ref[key], forward); |
1252 } |
1254 } |
1253 |
1255 |
1254 const Target& target; |
1256 const Target& target; |
1255 const Source& source; |
1257 const Source& source; |
1269 |
1271 |
1270 /// \brief Destructor of the GraphCopy |
1272 /// \brief Destructor of the GraphCopy |
1271 /// |
1273 /// |
1272 /// Destructor of the GraphCopy |
1274 /// Destructor of the GraphCopy |
1273 ~BpUGraphCopy() { |
1275 ~BpUGraphCopy() { |
1274 for (int i = 0; i < (int)aNodeMapCopies.size(); ++i) { |
1276 for (int i = 0; i < int(aNodeMapCopies.size()); ++i) { |
1275 delete aNodeMapCopies[i]; |
1277 delete aNodeMapCopies[i]; |
1276 } |
1278 } |
1277 for (int i = 0; i < (int)bNodeMapCopies.size(); ++i) { |
1279 for (int i = 0; i < int(bNodeMapCopies.size()); ++i) { |
1278 delete bNodeMapCopies[i]; |
1280 delete bNodeMapCopies[i]; |
1279 } |
1281 } |
1280 for (int i = 0; i < (int)nodeMapCopies.size(); ++i) { |
1282 for (int i = 0; i < int(nodeMapCopies.size()); ++i) { |
1281 delete nodeMapCopies[i]; |
1283 delete nodeMapCopies[i]; |
1282 } |
1284 } |
1283 for (int i = 0; i < (int)edgeMapCopies.size(); ++i) { |
1285 for (int i = 0; i < int(edgeMapCopies.size()); ++i) { |
1284 delete edgeMapCopies[i]; |
1286 delete edgeMapCopies[i]; |
1285 } |
1287 } |
1286 for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) { |
1288 for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) { |
1287 delete uEdgeMapCopies[i]; |
1289 delete uEdgeMapCopies[i]; |
1288 } |
1290 } |
1289 |
1291 |
1290 } |
1292 } |
1291 |
1293 |
1391 } |
1393 } |
1392 |
1394 |
1393 /// \brief Make a copy of the given node. |
1395 /// \brief Make a copy of the given node. |
1394 /// |
1396 /// |
1395 /// Make a copy of the given node. |
1397 /// Make a copy of the given node. |
1396 BpUGraphCopy& node(TNode& tnode, const Node& node) { |
1398 BpUGraphCopy& node(TNode& tnode, const Node& snode) { |
1397 nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Node, |
1399 nodeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Node, |
1398 NodeRefMap, TNode>(tnode, node)); |
1400 NodeRefMap, TNode>(tnode, snode)); |
1399 return *this; |
1401 return *this; |
1400 } |
1402 } |
1401 |
1403 |
1402 /// \brief Copies the edge references into the given map. |
1404 /// \brief Copies the edge references into the given map. |
1403 /// |
1405 /// |
1434 } |
1436 } |
1435 |
1437 |
1436 /// \brief Make a copy of the given edge. |
1438 /// \brief Make a copy of the given edge. |
1437 /// |
1439 /// |
1438 /// Make a copy of the given edge. |
1440 /// Make a copy of the given edge. |
1439 BpUGraphCopy& edge(TEdge& tedge, const Edge& edge) { |
1441 BpUGraphCopy& edge(TEdge& tedge, const Edge& sedge) { |
1440 edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Edge, |
1442 edgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, Edge, |
1441 EdgeRefMap, TEdge>(tedge, edge)); |
1443 EdgeRefMap, TEdge>(tedge, sedge)); |
1442 return *this; |
1444 return *this; |
1443 } |
1445 } |
1444 |
1446 |
1445 /// \brief Copies the undirected edge references into the given map. |
1447 /// \brief Copies the undirected edge references into the given map. |
1446 /// |
1448 /// |
1477 } |
1479 } |
1478 |
1480 |
1479 /// \brief Make a copy of the given undirected edge. |
1481 /// \brief Make a copy of the given undirected edge. |
1480 /// |
1482 /// |
1481 /// Make a copy of the given undirected edge. |
1483 /// Make a copy of the given undirected edge. |
1482 BpUGraphCopy& uEdge(TUEdge& tuedge, const UEdge& uedge) { |
1484 BpUGraphCopy& uEdge(TUEdge& tuedge, const UEdge& suedge) { |
1483 uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, UEdge, |
1485 uEdgeMapCopies.push_back(new _graph_utils_bits::ItemCopy<Source, UEdge, |
1484 UEdgeRefMap, TUEdge>(tuedge, uedge)); |
1486 UEdgeRefMap, TUEdge>(tuedge, suedge)); |
1485 return *this; |
1487 return *this; |
1486 } |
1488 } |
1487 |
1489 |
1488 /// \brief Executes the copies. |
1490 /// \brief Executes the copies. |
1489 /// |
1491 /// |
1494 NodeRefMap nodeRefMap(source, aNodeRefMap, bNodeRefMap); |
1496 NodeRefMap nodeRefMap(source, aNodeRefMap, bNodeRefMap); |
1495 UEdgeRefMap uEdgeRefMap(source); |
1497 UEdgeRefMap uEdgeRefMap(source); |
1496 EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap); |
1498 EdgeRefMap edgeRefMap(target, source, uEdgeRefMap, nodeRefMap); |
1497 _graph_utils_bits::BpUGraphCopySelector<Target>:: |
1499 _graph_utils_bits::BpUGraphCopySelector<Target>:: |
1498 copy(target, source, aNodeRefMap, bNodeRefMap, uEdgeRefMap); |
1500 copy(target, source, aNodeRefMap, bNodeRefMap, uEdgeRefMap); |
1499 for (int i = 0; i < (int)aNodeMapCopies.size(); ++i) { |
1501 for (int i = 0; i < int(aNodeMapCopies.size()); ++i) { |
1500 aNodeMapCopies[i]->copy(source, aNodeRefMap); |
1502 aNodeMapCopies[i]->copy(source, aNodeRefMap); |
1501 } |
1503 } |
1502 for (int i = 0; i < (int)bNodeMapCopies.size(); ++i) { |
1504 for (int i = 0; i < int(bNodeMapCopies.size()); ++i) { |
1503 bNodeMapCopies[i]->copy(source, bNodeRefMap); |
1505 bNodeMapCopies[i]->copy(source, bNodeRefMap); |
1504 } |
1506 } |
1505 for (int i = 0; i < (int)nodeMapCopies.size(); ++i) { |
1507 for (int i = 0; i < int(nodeMapCopies.size()); ++i) { |
1506 nodeMapCopies[i]->copy(source, nodeRefMap); |
1508 nodeMapCopies[i]->copy(source, nodeRefMap); |
1507 } |
1509 } |
1508 for (int i = 0; i < (int)uEdgeMapCopies.size(); ++i) { |
1510 for (int i = 0; i < int(uEdgeMapCopies.size()); ++i) { |
1509 uEdgeMapCopies[i]->copy(source, uEdgeRefMap); |
1511 uEdgeMapCopies[i]->copy(source, uEdgeRefMap); |
1510 } |
1512 } |
1511 for (int i = 0; i < (int)edgeMapCopies.size(); ++i) { |
1513 for (int i = 0; i < int(edgeMapCopies.size()); ++i) { |
1512 edgeMapCopies[i]->copy(source, edgeRefMap); |
1514 edgeMapCopies[i]->copy(source, edgeRefMap); |
1513 } |
1515 } |
1514 } |
1516 } |
1515 |
1517 |
1516 private: |
1518 private: |
1775 /// \brief Erase more keys from the map. |
1777 /// \brief Erase more keys from the map. |
1776 /// |
1778 /// |
1777 /// Erase more keys from the map. It is called by the |
1779 /// Erase more keys from the map. It is called by the |
1778 /// \c AlterationNotifier. |
1780 /// \c AlterationNotifier. |
1779 virtual void erase(const std::vector<Key>& keys) { |
1781 virtual void erase(const std::vector<Key>& keys) { |
1780 for (int i = 0; i < (int)keys.size(); ++i) { |
1782 for (int i = 0; i < int(keys.size()); ++i) { |
1781 Value val = Map::operator[](keys[i]); |
1783 Value val = Map::operator[](keys[i]); |
1782 typename Container::iterator it = invMap.find(val); |
1784 typename Container::iterator it = invMap.find(val); |
1783 if (it != invMap.end() && it->second == keys[i]) { |
1785 if (it != invMap.end() && it->second == keys[i]) { |
1784 invMap.erase(it); |
1786 invMap.erase(it); |
1785 } |
1787 } |
1871 /// \brief Constructor. |
1873 /// \brief Constructor. |
1872 /// |
1874 /// |
1873 /// Constructor for descriptor map. |
1875 /// Constructor for descriptor map. |
1874 explicit DescriptorMap(const Graph& _graph) : Map(_graph) { |
1876 explicit DescriptorMap(const Graph& _graph) : Map(_graph) { |
1875 Item it; |
1877 Item it; |
1876 const typename Map::Notifier* notifier = Map::notifier(); |
1878 const typename Map::Notifier* nf = Map::notifier(); |
1877 for (notifier->first(it); it != INVALID; notifier->next(it)) { |
1879 for (nf->first(it); it != INVALID; nf->next(it)) { |
1878 Map::set(it, invMap.size()); |
1880 Map::set(it, invMap.size()); |
1879 invMap.push_back(it); |
1881 invMap.push_back(it); |
1880 } |
1882 } |
1881 } |
1883 } |
1882 |
1884 |
1896 /// |
1898 /// |
1897 /// Add more new keys to the map. It is called by the |
1899 /// Add more new keys to the map. It is called by the |
1898 /// \c AlterationNotifier. |
1900 /// \c AlterationNotifier. |
1899 virtual void add(const std::vector<Item>& items) { |
1901 virtual void add(const std::vector<Item>& items) { |
1900 Map::add(items); |
1902 Map::add(items); |
1901 for (int i = 0; i < (int)items.size(); ++i) { |
1903 for (int i = 0; i < int(items.size()); ++i) { |
1902 Map::set(items[i], invMap.size()); |
1904 Map::set(items[i], invMap.size()); |
1903 invMap.push_back(items[i]); |
1905 invMap.push_back(items[i]); |
1904 } |
1906 } |
1905 } |
1907 } |
1906 |
1908 |
1918 /// \brief Erase more keys from the map. |
1920 /// \brief Erase more keys from the map. |
1919 /// |
1921 /// |
1920 /// Erase more keys from the map. It is called by the |
1922 /// Erase more keys from the map. It is called by the |
1921 /// \c AlterationNotifier. |
1923 /// \c AlterationNotifier. |
1922 virtual void erase(const std::vector<Item>& items) { |
1924 virtual void erase(const std::vector<Item>& items) { |
1923 for (int i = 0; i < (int)items.size(); ++i) { |
1925 for (int i = 0; i < int(items.size()); ++i) { |
1924 Map::set(invMap.back(), Map::operator[](items[i])); |
1926 Map::set(invMap.back(), Map::operator[](items[i])); |
1925 invMap[Map::operator[](items[i])] = invMap.back(); |
1927 invMap[Map::operator[](items[i])] = invMap.back(); |
1926 invMap.pop_back(); |
1928 invMap.pop_back(); |
1927 } |
1929 } |
1928 Map::erase(items); |
1930 Map::erase(items); |
1933 /// Build the unique map. It is called by the |
1935 /// Build the unique map. It is called by the |
1934 /// \c AlterationNotifier. |
1936 /// \c AlterationNotifier. |
1935 virtual void build() { |
1937 virtual void build() { |
1936 Map::build(); |
1938 Map::build(); |
1937 Item it; |
1939 Item it; |
1938 const typename Map::Notifier* notifier = Map::notifier(); |
1940 const typename Map::Notifier* nf = Map::notifier(); |
1939 for (notifier->first(it); it != INVALID; notifier->next(it)) { |
1941 for (nf->first(it); it != INVALID; nf->next(it)) { |
1940 Map::set(it, invMap.size()); |
1942 Map::set(it, invMap.size()); |
1941 invMap.push_back(it); |
1943 invMap.push_back(it); |
1942 } |
1944 } |
1943 } |
1945 } |
1944 |
1946 |
2311 virtual void add(const Edge& edge) { |
2313 virtual void add(const Edge& edge) { |
2312 ++deg[graph.target(edge)]; |
2314 ++deg[graph.target(edge)]; |
2313 } |
2315 } |
2314 |
2316 |
2315 virtual void add(const std::vector<Edge>& edges) { |
2317 virtual void add(const std::vector<Edge>& edges) { |
2316 for (int i = 0; i < (int)edges.size(); ++i) { |
2318 for (int i = 0; i < int(edges.size()); ++i) { |
2317 ++deg[graph.target(edges[i])]; |
2319 ++deg[graph.target(edges[i])]; |
2318 } |
2320 } |
2319 } |
2321 } |
2320 |
2322 |
2321 virtual void erase(const Edge& edge) { |
2323 virtual void erase(const Edge& edge) { |
2322 --deg[graph.target(edge)]; |
2324 --deg[graph.target(edge)]; |
2323 } |
2325 } |
2324 |
2326 |
2325 virtual void erase(const std::vector<Edge>& edges) { |
2327 virtual void erase(const std::vector<Edge>& edges) { |
2326 for (int i = 0; i < (int)edges.size(); ++i) { |
2328 for (int i = 0; i < int(edges.size()); ++i) { |
2327 --deg[graph.target(edges[i])]; |
2329 --deg[graph.target(edges[i])]; |
2328 } |
2330 } |
2329 } |
2331 } |
2330 |
2332 |
2331 virtual void build() { |
2333 virtual void build() { |
2423 virtual void add(const Edge& edge) { |
2425 virtual void add(const Edge& edge) { |
2424 ++deg[graph.source(edge)]; |
2426 ++deg[graph.source(edge)]; |
2425 } |
2427 } |
2426 |
2428 |
2427 virtual void add(const std::vector<Edge>& edges) { |
2429 virtual void add(const std::vector<Edge>& edges) { |
2428 for (int i = 0; i < (int)edges.size(); ++i) { |
2430 for (int i = 0; i < int(edges.size()); ++i) { |
2429 ++deg[graph.source(edges[i])]; |
2431 ++deg[graph.source(edges[i])]; |
2430 } |
2432 } |
2431 } |
2433 } |
2432 |
2434 |
2433 virtual void erase(const Edge& edge) { |
2435 virtual void erase(const Edge& edge) { |
2434 --deg[graph.source(edge)]; |
2436 --deg[graph.source(edge)]; |
2435 } |
2437 } |
2436 |
2438 |
2437 virtual void erase(const std::vector<Edge>& edges) { |
2439 virtual void erase(const std::vector<Edge>& edges) { |
2438 for (int i = 0; i < (int)edges.size(); ++i) { |
2440 for (int i = 0; i < int(edges.size()); ++i) { |
2439 --deg[graph.source(edges[i])]; |
2441 --deg[graph.source(edges[i])]; |
2440 } |
2442 } |
2441 } |
2443 } |
2442 |
2444 |
2443 virtual void build() { |
2445 virtual void build() { |