LIMA
Libre Multilingual Analyzer — C++ API
Loading...
Searching...
No Matches
DependencyGraph.h
Go to the documentation of this file.
1// Copyright 2002-2013 CEA LIST
2// SPDX-FileCopyrightText: 2022 CEA LIST <gael.de-chalendar@cea.fr>
3//
4// SPDX-License-Identifier: MIT
5
18#ifndef LIMA_SYNTACTICANALYSIS_DEPENDENCYGRAPH_H
19#define LIMA_SYNTACTICANALYSIS_DEPENDENCYGRAPH_H
20
24#include "linguisticProcessing/common/linguisticData/languageData.h" // for SyntacticRelationId
25
26#include <vector>
27#include <stdexcept>
28#include <boost/graph/adjacency_list.hpp>
30
31//========== Vertex properties
32
34typedef boost::property<boost::vertex_color_t, boost::default_color_type> VertexDependencyGraphColorProperty;
35
38
39
40//========== Edges properties
41
42
44// enum edge_depchain_id_t { edge_depchain_id = 5000 };
45// typedef boost::property< edge_depchain_id_t, Lima::LinguisticProcessing::LinguisticAnalysisStructure::ChainIdStruct > DepChainIdProperty;
46// namespace boost {BOOST_INSTALL_PROPERTY(edge, depchain_id);}
47
51typedef boost::property< edge_deprel_type_t, DepRelTypeProp > DepRelTypeProperty;
52namespace boost {BOOST_INSTALL_PROPERTY(edge, deprel_type);}
53
54
57
58
59// ============ Graph class
60
63typedef boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS,
65
68typedef DependencyGraph::edge_descriptor DependencyGraphEdge;
69typedef DependencyGraph::edge_iterator DependencyGraphEdgeIt;
70typedef DependencyGraph::out_edge_iterator DependencyGraphOutEdgeIt;
71typedef DependencyGraph::in_edge_iterator DependencyGraphInEdgeIt;
72typedef DependencyGraph::vertex_descriptor DependencyGraphVertex;
73typedef DependencyGraph::vertex_iterator DependencyGraphVertexIt;
74typedef DependencyGraph::adjacency_iterator DependencyGraphAdjacencyIt;
75typedef boost::property_map<DependencyGraph, edge_deprel_type_t>::type EdgeDepRelTypePropertyMap;
76typedef boost::property_map<DependencyGraph, edge_deprel_type_t>::const_type CEdgeDepRelTypePropertyMap;
77// typedef boost::property_map<DependencyGraph, edge_depchain_id_t>::type EdgeDepChainIdPropertyMap;
78// typedef boost::property_map<DependencyGraph, edge_depchain_id_t>::const_type CEdgeDepChainIdPropertyMap;
79typedef boost::property_map<DependencyGraph, boost::vertex_color_t >::type
82
87inline bool operator<(const std::pair<DependencyGraphVertex, DependencyGraphVertex>& e1,
88 const std::pair<DependencyGraphVertex, DependencyGraphVertex>& e2)
89{
90 return ( (e1.first < e2.first) || (e1.first == e2.first && e1.second < e2.second) );
91}
92
93namespace Lima {
94namespace LinguisticProcessing {
95namespace SyntacticAnalysis {
96
97#define SAPLOGINIT LOGINIT("LP::SyntacticAnalysis::Deps")
98
99} // closing namespace SyntacticAnalysis
100} // closing namespace LinguisticProcessing
101} // closing namespace Lima
102
103
104#endif
Lima::Common::MediaticData::SyntacticRelationId DepRelTypeProp
Property to identify the chain of the tokens graph concerned by the relation.
bool operator<(const std::pair< DependencyGraphVertex, DependencyGraphVertex > &e1, const std::pair< DependencyGraphVertex, DependencyGraphVertex > &e2)
Comparison operator to order pairs of dependency graph vertices.
DependencyGraph::edge_iterator DependencyGraphEdgeIt
DependencyGraph::edge_descriptor DependencyGraphEdge
typedefs to simplify the acces to various graphs elements
boost::property< edge_deprel_type_t, DepRelTypeProp > DepRelTypeProperty
DependencyGraph::in_edge_iterator DependencyGraphInEdgeIt
DependencyGraph::vertex_iterator DependencyGraphVertexIt
DependencyGraph::adjacency_iterator DependencyGraphAdjacencyIt
DependencyGraph::out_edge_iterator DependencyGraphOutEdgeIt
boost::property_map< DependencyGraph, edge_deprel_type_t >::type EdgeDepRelTypePropertyMap
VertexDependencyGraphColorProperty DepVertexProperties
Final declaration of the vertices properties.
DependencyGraph::vertex_descriptor DependencyGraphVertex
boost::property< boost::vertex_color_t, boost::default_color_type > VertexDependencyGraphColorProperty
Default color property to use in various algorithms.
boost::property_map< DependencyGraph, edge_deprel_type_t >::const_type CEdgeDepRelTypePropertyMap
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, DepVertexProperties, DepEdgeProperties > DependencyGraph
The dependency graph class.
DepRelTypeProperty DepEdgeProperties
Final declaration of the edges properties.
boost::property_map< DependencyGraph, boost::vertex_color_t >::type VertexColorDepGraphPropertyMap
edge_deprel_type_t
@ edge_deprel_type
A graph structure for linguistic analysis.
NAUTITIA.
BOOST_INSTALL_PROPERTY(vertex, text)