Fishnet 2.0.1
Framework for Graph-Based Analysis of GIS Vector Data
Loading...
Searching...
No Matches
DegreeCentrality.hpp
Go to the documentation of this file.
1#pragma once
2#include <fishnet/Graph.hpp>
3#include <vector>
4namespace fishnet::graph {
10 template<Graph G>
11 std::vector<std::pair<typename G::node_type,size_t>> operator() (const G & graph) const{
12 std::vector<std::pair<typename G::node_type,size_t>> result;
13 auto nodes = graph.getNodes();
14 result.reserve(fishnet::util::size(nodes));
15 std::transform(nodes.begin(),nodes.end(),std::back_inserter(result),[&graph]( const auto & node){return std::make_pair(node,fishnet::util::size(graph.getNeighbours(node)));});
16 return result;
17 }
18};
19}
Definition AdjacencyContainer.hpp:4
constexpr size_t size(std::ranges::range auto &&range) noexcept
Definition CollectionConcepts.hpp:50
Degree Centrality functor Returns a vector of pairs, with each pair storing the node and the degree c...
Definition DegreeCentrality.hpp:9
std::vector< std::pair< typename G::node_type, size_t > > operator()(const G &graph) const
Definition DegreeCentrality.hpp:11