OpenRadioss 2025.1.11
OpenRadioss project
Loading...
Searching...
No Matches
Graph.hpp
Go to the documentation of this file.
1//Copyright> OpenRadioss
2//Copyright> Copyright (C) 1986-2025 Altair Engineering Inc.
3//Copyright>
4//Copyright> This program is free software: you can redistribute it and/or modify
5//Copyright> it under the terms of the GNU Affero General Public License as published by
6//Copyright> the Free Software Foundation, either version 3 of the License, or
7//Copyright> (at your option) any later version.
8//Copyright>
9//Copyright> This program is distributed in the hope that it will be useful,
10//Copyright> but WITHOUT ANY WARRANTY; without even the implied warranty of
11//Copyright> MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12//Copyright> GNU Affero General Public License for more details.
13//Copyright>
14//Copyright> You should have received a copy of the GNU Affero General Public License
15//Copyright> along with this program. If not, see <https://www.gnu.org/licenses/>.
16//Copyright>
17//Copyright>
18//Copyright> Commercial Alternative: Altair Radioss Software
19//Copyright>
20//Copyright> As an alternative to this open-source version, Altair also offers Altair Radioss
21//Copyright> software under a commercial license. Contact Altair to discuss further if the
22//Copyright> commercial version may interest you: https://www.altair.com/radioss/.
23#ifndef GRAPH_H_
24#define GRAPH_H_
25#include <iostream>
26#include <vector>
27#include <algorithm>
28#include <iterator>
29
36
37class Graph {
38public:
39 // Default ctr
40 Graph(){};
41 // Default destructor
42 ~Graph(){};
43 // Ctr with a given list of connexions
44 Graph(const int& npt, const int& nconnect, const std::vector<int>& connect_list);
45 // Build paths
46 void build_path();
47 // Build cycles
48 std::vector<bool> build_cycle();
50 const std::vector<std::vector<int>>& getPath() const {return m_path;}
51 const int& getTotalSize() const {return m_total_size;};
52 const std::vector<std::vector<int>>& getAdjList() const {return m_adj_list;};
53 void print() const;
54private:
55 int m_npt;
59 std::vector<std::vector<int>> m_adj_list, m_path_diag, m_path;
60 std::vector<int> m_degree;
61 std::vector<int> m_color;
62 // Depth first search
63 std::vector<int> dfs(int p0, std::vector<int>&);
64};
65#endif
const int & getTotalSize() const
Definition Graph.hpp:51
const int & getNbConnectedComponents() const
Definition Graph.hpp:49
std::vector< int > dfs(int p0, std::vector< int > &)
Definition Graph.cpp:45
const std::vector< std::vector< int > > & getPath() const
Definition Graph.hpp:50
std::vector< std::vector< int > > m_path_diag
Definition Graph.hpp:59
Graph(const int &npt, const int &nconnect, const std::vector< int > &connect_list)
void build_path()
Definition Graph.cpp:74
const std::vector< std::vector< int > > & getAdjList() const
Definition Graph.hpp:52
std::vector< std::vector< int > > m_adj_list
Definition Graph.hpp:59
~Graph()
Definition Graph.hpp:42
int m_nb_connected_components
Definition Graph.hpp:57
std::vector< int > m_color
Definition Graph.hpp:61
int m_nconnect
Definition Graph.hpp:56
std::vector< std::vector< int > > m_path
Definition Graph.hpp:59
int m_npt
Definition Graph.hpp:55
Graph()
Definition Graph.hpp:40
std::vector< int > m_degree
Definition Graph.hpp:60
void print() const
Definition Graph.cpp:145
std::vector< bool > build_cycle()
Definition Graph.cpp:108
int m_total_size
Definition Graph.hpp:58
int * m_sizes
Definition Graph.hpp:33
int * m_paths
Definition Graph.hpp:34
int m_total_size
Definition Graph.hpp:32
int m_nb_connected_components
Definition Graph.hpp:32