LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
LinguisticGraph.h
Go to the documentation of this file.
1// Copyright 2002-2020 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
16#ifndef LIMA_LINGUISTICPROCESSING_LINGUISTICANALYSISSTRUCTURE_LINGUISTICGRAPH_H
17#define LIMA_LINGUISTICPROCESSING_LINGUISTICANALYSISSTRUCTURE_LINGUISTICGRAPH_H
18
19#include "Token.h"
20#include "MorphoSyntacticData.h"
21#include "ChainIdStruct.h"
22
23
24#include <vector>
25#include <boost/graph/adjacency_list.hpp>
27#include <boost/graph/breadth_first_search.hpp>
28#include <boost/serialization/strong_typedef.hpp>
29
30
31//========== defines
32// the graphs are always constructed such as first vertex is numbered 0
33// and last vertex is numbered 1
34//========== Vertex properties
42typedef boost::property< vertex_token_t, VertexTokenProp > VertexTokenProperty;
43namespace boost {BOOST_INSTALL_PROPERTY(vertex, token);}
44
49enum vertex_data_t { vertex_data = 1001 };
50typedef boost::property< vertex_data_t, VertexDataProp, VertexTokenProperty > VertexDataProperty;
51namespace boost {BOOST_INSTALL_PROPERTY(vertex, data);}
52
53
54typedef boost::property<boost::vertex_color_t, boost::default_color_type, VertexDataProperty> VertexLinguisticGraphColorProperty;
55
60typedef std::set< Lima::LinguisticProcessing::LinguisticAnalysisStructure::ChainIdStruct > VertexChainIdProp;
62typedef boost::property< vertex_chain_id_t, VertexChainIdProp, VertexLinguisticGraphColorProperty > VertexChainIdProperty;
63namespace boost {BOOST_INSTALL_PROPERTY(vertex, chain_id);}
64
67
68
69//========== Edges properties
74// typedef std::set< Lima::LinguisticProcessing::LinguisticAnalysisStructure::ChainIdStruct > ChainIdProp;
75//
76// enum edge_chain_id_t { edge_chain_id = 2002 };
77// typedef boost::property< edge_chain_id_t, ChainIdProp > ChainIdProperty;
78// namespace boost {BOOST_INSTALL_PROPERTY(edge, chain_id);}
79
81// typedef ChainIdProperty LinguisticEdgeProperties;
82
83// ============ Graph class
84
92typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS,
93LinguisticVertexProperties/*,LinguisticEdgeProperties*/> LinguisticGraph;
94
96typedef boost::graph_traits< LinguisticGraph >::edge_descriptor LinguisticGraphEdge;
97typedef LinguisticGraph::edge_iterator LinguisticGraphEdgeIt;
98typedef LinguisticGraph::out_edge_iterator LinguisticGraphOutEdgeIt;
99typedef LinguisticGraph::in_edge_iterator LinguisticGraphInEdgeIt;
100typedef LinguisticGraph::vertex_descriptor LinguisticGraphVertex;
101//BOOST_STRONG_TYPEDEF(LinguisticGraph::vertex_descriptor, LinguisticGraphVertex);
102typedef LinguisticGraph::vertex_iterator LinguisticGraphVertexIt;
103typedef LinguisticGraph::adjacency_iterator LinguisticGraphAdjacencyIt;
104typedef boost::property_map<LinguisticGraph, vertex_token_t>::type VertexTokenPropertyMap;
105typedef boost::property_map<LinguisticGraph, vertex_token_t>::const_type CVertexTokenPropertyMap;
106typedef boost::property_map<LinguisticGraph, vertex_data_t>::type VertexDataPropertyMap;
107typedef boost::property_map<LinguisticGraph, vertex_data_t>::const_type CVertexDataPropertyMap;
108typedef boost::property_map<LinguisticGraph, vertex_chain_id_t>::type VertexChainIdPropertyMap;
109typedef boost::property_map<LinguisticGraph, vertex_chain_id_t>::const_type CVertexChainIdPropertyMap;
110
111typedef std::set<LinguisticGraphVertex> SetOfLinguisticGraphVertices;
112
113// typedef boost::property_map<LinguisticGraph, edge_chain_id_t>::type EdgeChainIdPropertyMap;
114typedef boost::property_map<LinguisticGraph, boost::vertex_color_t >::type VertexColorLinguisticGraphPropertyMap;
115
118
119#endif // LIMA_GRAPH_PHOENIXGRAPH_H
#define LIMA_LINGUISTICANALYSISSTRUCTURE_EXPORT
boost::property_map< LinguisticGraph, vertex_token_t >::const_type CVertexTokenPropertyMap
LinguisticGraph::in_edge_iterator LinguisticGraphInEdgeIt
boost::property_map< LinguisticGraph, vertex_data_t >::const_type CVertexDataPropertyMap
boost::property< vertex_data_t, VertexDataProp, VertexTokenProperty > VertexDataProperty
std::set< Lima::LinguisticProcessing::LinguisticAnalysisStructure::ChainIdStruct > VertexChainIdProp
Property to identify the chains in the graph.
boost::property_map< LinguisticGraph, vertex_chain_id_t >::type VertexChainIdPropertyMap
boost::property_map< LinguisticGraph, vertex_data_t >::type VertexDataPropertyMap
boost::graph_traits< LinguisticGraph >::edge_descriptor LinguisticGraphEdge
typedefs to simplify the access to various graphs elements
LinguisticGraph::vertex_iterator LinguisticGraphVertexIt
VertexChainIdProperty LinguisticVertexProperties
Final declaration of the vertices properties.
std::set< LinguisticGraphVertex > SetOfLinguisticGraphVertices
boost::property_map< LinguisticGraph, vertex_token_t >::type VertexTokenPropertyMap
vertex_token_t
@ vertex_token
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
boost::property_map< LinguisticGraph, vertex_chain_id_t >::const_type CVertexChainIdPropertyMap
boost::property_map< LinguisticGraph, boost::vertex_color_t >::type VertexColorLinguisticGraphPropertyMap
Lima::LinguisticProcessing::LinguisticAnalysisStructure::Token * VertexTokenProp
This vertex proprerty represents the linguistic object pointed by the node with position and length.
vertex_data_t
@ vertex_data
Lima::LinguisticProcessing::LinguisticAnalysisStructure::MorphoSyntacticData * VertexDataProp
This vertex proprerty represents the linguitic object pointed by the node It points to only one word ...
LinguisticGraph::out_edge_iterator LinguisticGraphOutEdgeIt
LinguisticGraph::edge_iterator LinguisticGraphEdgeIt
boost::property< vertex_chain_id_t, VertexChainIdProp, VertexLinguisticGraphColorProperty > VertexChainIdProperty
LIMA_LINGUISTICANALYSISSTRUCTURE_EXPORT QDebug & operator<<(QDebug &qd, LinguisticGraphEdge &edge)
boost::property< boost::vertex_color_t, boost::default_color_type, VertexDataProperty > VertexLinguisticGraphColorProperty
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, LinguisticVertexProperties > LinguisticGraph
Property to identify the chains in the graph.
LinguisticGraph::adjacency_iterator LinguisticGraphAdjacencyIt
vertex_chain_id_t
@ vertex_chain_id
boost::property< vertex_token_t, VertexTokenProp > VertexTokenProperty
BOOST_INSTALL_PROPERTY(vertex, text)