<commit_before>/*M///////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2015, <NAME>
// Copyright (c) 2015, ELM Library Project
// 3-clause BSD License
//
//M*/
#ifndef _ELM_CORE_GRAPH_GRAPHATTR_IMPL_H_
#define _ELM_CORE_GRAPH_GRAPHATTR_IMPL_H_

#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/undirected_graph.hpp>

#include "elm/core/typedefs_fwd.h"

#include <opencv2/core/core.hpp>

namespace elm {

typedef boost::property<boost::edge_weight_t, float> EdgeWeightProp;
typedef boost::property<boost::vertex_color_t, float,
        boost::property<boost::vertex_index2_t, cv::Mat1f > >
        VtxProp;
typedef boost::undirected_graph<VtxProp, EdgeWeightProp> GraphAttrType;

//typedef boost::adjacency_list<boost::vecS, boost::vecS, boost::undirectedS, VtxProp, EdgeWeightProp> GraphAttrType;
typedef boost::graph_traits<GraphAttrType> GraphAttrTraits;
typedef GraphAttrTraits::edge_iterator edge_iter;
typedef GraphAttrTraits::vertex_descriptor VtxDescriptor;

/**
 * @brief full GraphAttr implementation class
 * Enforces a list of unique vertices accroding to their main property
 */
struct GraphAttr_Impl
{
    /**
     * @brief Default constructor
     */
    GraphAttr_Impl();

    /**
     * @brief Construct an attributed Graph from map representing image
     * @param map
     * @param mask for excluding invalid elements (set to false to exclude)
     */
    GraphAttr_Impl(const cv::Mat1f &map_img, const cv::Mat1b &mask);

    bool findVertex(float vtx_id, VtxDescriptor &vtx_descriptor) const;

    void removeEdges(float vtx_u, float vtx_v, VtxDescriptor &u, VtxDescriptor &v);

    void removeEdges(const VtxDescriptor &u, const VtxDescriptor &v);

    void removeVertex(float vtx_id, const VtxDescriptor &vtx);

    // public members<commit_msg>to avoid parallel edges, goig from undirected_graph definition to adjacency_list use setS for OuterEdgeList<commit_after>/*M///////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2015, <NAME>
// Copyright (c) 2015, ELM Library Project
// 3-clause BSD License
//
//M*/
#ifndef _ELM_CORE_GRAPH_GRAPHATTR_IMPL_H_
#define _ELM_CORE_GRAPH_GRAPHATTR_IMPL_H_

#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
//#include <boost/graph/undirected_graph.hpp>

#include "elm/core/typedefs_fwd.h"

#include <opencv2/core/core.hpp>

namespace elm {

typedef boost::property<boost::edge_weight_t, float> EdgeWeightProp;
typedef boost::property<boost::vertex_color_t, float,
        boost::property<boost::vertex_index2_t, cv::Mat1f > >
        VtxProp;
//typedef boost::undirected_graph<VtxProp, EdgeWeightProp> GraphAttrType;

typedef boost::adjacency_list<boost::setS, boost::vecS, boost::undirectedS, VtxProp, EdgeWeightProp> GraphAttrType;

typedef boost::graph_traits<GraphAttrType> GraphAttrTraits;
typedef GraphAttrTraits::edge_iterator edge_iter;
typedef GraphAttrTraits::vertex_descriptor VtxDescriptor;

/**
 * @brief full GraphAttr implementation class
 * Enforces a list of unique vertices accroding to their main property
 */
struct GraphAttr_Impl
{
    /**
     * @brief Default constructor
     */
    GraphAttr_Impl();

    /**
     * @brief Construct an attributed Graph from map representing image
     * @param map
     * @param mask for excluding invalid elements (set to false to exclude)
     */
    GraphAttr_Impl(const cv::Mat1f &map_img, const cv::Mat1b &mask);

    bool findVertex(float vtx_id, VtxDescriptor &vtx_descriptor) const;

    void removeEdges(float vtx_u, float vtx_v, VtxDescriptor &u, VtxDescriptor &v);

    void removeEdges(const VtxDescriptor &u, const VtxDescriptor &v);

    void removeVertex(float vtx_id, const VtxDescriptor &vtx);

    // public members
{'fraction_non_alphanumeric': 0.1441932969602494, 'fraction_numerical': 0.007274616783580151, 'mean_word_length': 3.8672566371681416, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1773701', 'n_tokens_mistral': 1264, 'n_tokens_neox': 1173, 'n_words': 294}