6 #ifndef WIRECELL_ICLUSTER 7 #define WIRECELL_ICLUSTER 17 #include <boost/graph/graph_traits.hpp> 18 #include <boost/graph/adjacency_list.hpp> 19 #include <boost/graph/connected_components.hpp> 52 if (ind == std::variant_npos) {
return 0; }
56 return ptr == other.
ptr;
71 switch (n.
ptr.index()) {
72 case 0: h=std::get<0>(n.
ptr);
break;
73 case 1: h=(std::size_t)std::get<1>(n.
ptr).get();
break;
74 case 2: h=(std::size_t)std::get<2>(n.
ptr).get();
break;
75 case 3: h=(std::size_t)std::get<3>(n.
ptr).get();
break;
76 case 4: h=(std::size_t)std::get<4>(n.
ptr).get();
break;
77 case 5: h=(std::size_t)std::get<5>(n.
ptr).get();
break;
87 typedef boost::adjacency_list<boost::setS, boost::vecS, boost::undirectedS, cluster_node_t>
cluster_graph_t;
89 typedef boost::graph_traits<cluster_graph_t>::edge_descriptor
cluster_edge_t;
98 virtual int ident()
const = 0;
101 virtual const cluster_graph_t&
graph()
const = 0;
107 template<
typename Type>
108 std::vector<Type>
oftype(
const cluster_indexed_graph_t&
g) {
109 std::vector<Type> ret;
110 for (
const auto& v : boost::make_iterator_range(boost::vertices(g.
graph()))) {
111 const auto& vp = g.
graph()[v];
112 if (std::holds_alternative<Type>(vp.ptr)) {
113 ret.push_back(std::get<Type>(vp.ptr));
119 template<
typename Type>
121 std::vector<Type> ret;
123 if (std::holds_alternative<Type>(vp.ptr)) {
124 ret.push_back(std::get<Type>(vp.ptr));
std::shared_ptr< const IChannel > pointer
IndexedGraph< cluster_node_t > cluster_indexed_graph_t
cluster_node_t(const IBlob::pointer &p)
cluster_node_t(const IChannel::pointer &p)
std::vector< Type > oftype(const cluster_indexed_graph_t &g)
std::vector< vertex_t > neighbors(vertex_t obj) const
cluster_node_t(const IChannel::shared_vector &p)
const graph_t & graph() const
def graph(desc, maker=maker)
cluster_node_t(const IWire::pointer &p)
std::size_t operator()(const WireCell::cluster_node_t &n) const
bool operator==(const cluster_node_t &other) const
boost::adjacency_list< boost::setS, boost::vecS, boost::undirectedS, cluster_node_t > cluster_graph_t
boost::graph_traits< cluster_graph_t >::edge_descriptor cluster_edge_t
cluster_node_t & operator=(const cluster_node_t &other)
cluster_node_t(const cluster_node_t &other)
cluster_node_t(const ISlice::pointer &p)
cluster_node_t(const cluster_ptr_t &p)
boost::graph_traits< cluster_graph_t >::vertex_descriptor cluster_vertex_t
boost::graph_traits< cluster_graph_t >::vertex_iterator cluster_vertex_iter_t
std::vector< Type > neighbors_oftype(const cluster_indexed_graph_t &g, const cluster_node_t &n)
std::shared_ptr< const vector > shared_vector
h
training ###############################
std::variant< size_t, IChannel::pointer, IWire::pointer, IBlob::pointer, ISlice::pointer, IChannel::shared_vector > cluster_ptr_t
The vertex property.