Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/networkit/graph/EdgeIterators.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class EdgeTypeRange {
public:
EdgeTypeRange(const GraphType &G) : G(&G) {}

EdgeTypeRange() : G(nullptr){};
EdgeTypeRange() : G(nullptr) {};

~EdgeTypeRange() = default;

Expand Down
18 changes: 11 additions & 7 deletions include/networkit/graph/Graph.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ class Graph {
* @brief Virtual method for forInEdgesOf - overridden by GraphW for vector-based iteration
*/
virtual void
forInEdgesVirtualImpl(node u, bool directed, bool weighted, bool hasEdgeIds,
std::function<void(node, node, edgeweight, edgeid)> handle) const;
forInEdgesOfVirtualImpl(node u, bool directed, bool weighted, bool hasEdgeIds,
std::function<void(node, node, edgeweight, edgeid)> handle) const;

/**
* @brief Virtual method for parallelSumForEdges - overridden by GraphW for vector-based
Expand Down Expand Up @@ -1198,7 +1198,7 @@ class Graph {
* @return Iterator range over the neighbors of @a u.
*/
NeighborRange<false> neighborRange(node u) const {
assert(exists[u]);
assert(hasNode(u));
return NeighborRange<false>(*this, u);
}

Expand All @@ -1212,7 +1212,7 @@ class Graph {
*/
NeighborWeightRange<false> weightNeighborRange(node u) const {
assert(isWeighted());
assert(exists[u]);
assert(hasNode(u));
return NeighborWeightRange<false>(*this, u);
}

Expand All @@ -1224,7 +1224,7 @@ class Graph {
*/
NeighborRange<true> inNeighborRange(node u) const {
assert(isDirected());
assert(exists[u]);
assert(hasNode(u));
return NeighborRange<true>(*this, u);
}

Expand All @@ -1238,7 +1238,7 @@ class Graph {
*/
NeighborWeightRange<true> weightInNeighborRange(node u) const {
assert(isDirected() && isWeighted());
assert(exists[u]);
assert(hasNode(u));
return NeighborWeightRange<true>(*this, u);
}

Expand Down Expand Up @@ -1737,7 +1737,7 @@ inline void Graph::forInEdgesOfImpl(node u, L handle) const {
// GraphW's forInEdgesVirtualImpl calls handle(v, u, ...) where v is neighbor and u is
// current node We need to swap so that edgeLambda receives (current, neighbor, ...) and
// passes neighbor to f
forInEdgesVirtualImpl(
forInEdgesOfVirtualImpl(
u, graphIsDirected, hasWeights, graphHasEdgeIds,
[&](node v, node u, edgeweight w, edgeid e) { edgeLambda(handle, u, v, w, e); });
}
Expand Down Expand Up @@ -1936,6 +1936,10 @@ void Graph::forEdgesOf(node u, L handle) const {
}
}
} else {
// For vector-based graphs (GraphW), use the virtual dispatch
// Check exists for mutable graphs
if (!exists[u])
return;
// For vector-based graphs, use virtual dispatch
forEdgesOfVirtualImpl(u, directed, weighted, edgesIndexed,
[&](node uu, node vv, edgeweight ww, edgeid ee) {
Expand Down
6 changes: 3 additions & 3 deletions include/networkit/graph/GraphW.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,7 @@ class GraphW final : public Graph {
/**
* @brief Override for vector-based forInEdgesOf
*/
void forInEdgesVirtualImpl(
void forInEdgesOfVirtualImpl(
node u, bool directed, bool weighted, bool hasEdgeIds,
std::function<void(node, node, edgeweight, edgeid)> handle) const override;

Expand Down Expand Up @@ -999,7 +999,7 @@ class GraphW final : public Graph {
public:
NeighborRange(const GraphW &G, node u) : G(&G), u(u) { assert(G.hasNode(u)); };

NeighborRange() : G(nullptr){};
NeighborRange() : G(nullptr) {};

NeighborIterator begin() const {
assert(G);
Expand Down Expand Up @@ -1037,7 +1037,7 @@ class GraphW final : public Graph {
public:
NeighborWeightRange(const GraphW &G, node u) : G(&G), u(u) { assert(G.hasNode(u)); };

NeighborWeightRange() : G(nullptr){};
NeighborWeightRange() : G(nullptr) {};

NeighborWeightIterator begin() const {
assert(G);
Expand Down
Loading
Loading