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>
4
namespace
fishnet::graph
{
9
struct
DegreeCentrality
{
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
}
Graph.hpp
fishnet::graph
Definition
AdjacencyContainer.hpp:4
fishnet::util::size
constexpr size_t size(std::ranges::range auto &&range) noexcept
Definition
CollectionConcepts.hpp:50
fishnet::graph::DegreeCentrality
Degree Centrality functor Returns a vector of pairs, with each pair storing the node and the degree c...
Definition
DegreeCentrality.hpp:9
fishnet::graph::DegreeCentrality::operator()
std::vector< std::pair< typename G::node_type, size_t > > operator()(const G &graph) const
Definition
DegreeCentrality.hpp:11
lib
graph
centrality
include
fishnet
DegreeCentrality.hpp
Generated by
1.9.8