ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/addin/outil/src/hypergraphlib_arc.h
Revision: 1156
Committed: Thu Jun 13 22:02:48 2024 UTC (14 months, 2 weeks ago) by francois
Content type: text/plain
File size: 2972 byte(s)
Log Message:
compatibilité Ubuntu 22.04
Suppression des refeences à Windows
Ajout d'une banière

File Contents

# User Rev Content
1 francois 1156 //####//------------------------------------------------------------
2     //####//------------------------------------------------------------
3     //####// MAGiC
4     //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5     //####// Departement de Genie Mecanique - UQTR
6     //####//------------------------------------------------------------
7     //####// MAGIC est un projet de recherche de l equipe ERICCA
8     //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9     //####// http://www.uqtr.ca/ericca
10     //####// http://www.uqtr.ca/
11     //####//------------------------------------------------------------
12     //####//------------------------------------------------------------
13     //####//
14     //####// hypergraphlib_arc.h
15     //####//
16     //####//------------------------------------------------------------
17     //####//------------------------------------------------------------
18     //####// COPYRIGHT 2000-2024
19     //####// jeu 13 jun 2024 11:54:00 EDT
20     //####//------------------------------------------------------------
21     //####//------------------------------------------------------------
22 francois 283 #ifndef ARC_H
23     #define ARC_H
24    
25 francois 481 #include "hypergraphlib_graphobject.h"
26 francois 283 #include <map>
27     #include <vector>
28    
29     #define ARC_FOR_EACH_NODE_CONST(A,N)\
30     for(HypergraphLib::Arc::MultimapNodesById::const_iterator N = A->Nodes().begin();\
31     N != A->Nodes().end(); N++)
32    
33     namespace HypergraphLib {
34    
35     class Node;
36    
37     class HYPERGRAPHLIB_ITEM Arc : public GraphObject {
38     public:
39     typedef std::multimap < int, Node * > MultimapNodesById;
40     typedef std::pair < int, Node * > Int_Node_Pair;
41    
42     /**
43     * Constructs an empty Arc
44     */
45     Arc(Graph* __owner, int __id);
46    
47     /**
48     * Constructor taking the graph, the arc's ID, and the array
49     * of node IDs of the arc
50     */
51     Arc(Graph* __owner, int __id, const std::vector <int> & __nodesId);
52    
53     /**
54     * Copy constructor
55     */
56     Arc(const Arc &, Graph * __owner=0);
57     ~Arc();
58    
59     /**
60     * Returns the array of nodes of the arc
61     */
62     MultimapNodesById & Nodes();
63    
64     /**
65     * Adds one node to the arc
66     */
67     void Add (Node *);
68    
69     /**
70     * Removes one occurence of the node ID in this arc
71     * Returns 1 if one occurence was found, but 0 if no
72     * occurences were found
73     */
74     int Remove (int __id);
75     int Remove (Node * __node);
76    
77     /**
78     * Returns the rank of this node
79     */
80     int Rank() const;
81    
82     /**
83     * Returns the number of ocurences of the specified node
84     * in this arc : this function will return "2" if it is a loop
85     * on this node
86     */
87     int NodeCount(int) const;
88    
89     /** Returns the first node in the arc */
90     Node * First() const;
91     /** Returns the last node in the arc */
92     Node * Last() const;
93     /** Returns wether this arc is a loop of the node X */
94     bool IsLoopOfNode(int __NodeId);
95     /** Returns wether this arc is a simple loop : has rank = 2
96     * and 2 times the same node */
97     bool IsLoop();
98    
99     private:
100     MultimapNodesById _nodes;
101     };
102    
103     }
104    
105     #endif