File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717/*** License: MPL v2.0 ***/
1818/***********************************************************/
1919
20- #ifndef __CXXGRAPH_DIRECTEDEDGE_H__
21- #define __CXXGRAPH_DIRECTEDEDGE_H__
20+ #ifndef CXXGRAPH_DIRECTEDEDGE_H
21+ #define CXXGRAPH_DIRECTEDEDGE_H
2222
2323#pragma once
2424
2525#include "DirectedEdge_impl.hpp"
2626
27- #endif // __CXXGRAPH_DIRECTEDEDGE_H__
27+ #endif // CXXGRAPH_DIRECTEDEDGE_H
Original file line number Diff line number Diff line change 3131namespace CXXGraph {
3232
3333using std::make_shared;
34- using std::make_unique;
3534
3635template <typename T>
37- Graph<T>::Graph() {
38- /* Caching the adjacency matrix */
39- cacheAdjMatrix ();
40- cacheDegreeMatrix ();
41- cacheLaplacianMatrix ();
42- cacheTransitionMatrix ();
43- }
36+ Graph<T>::Graph()
37+ : cachedAdjMatrix(Graph<T>::getAdjMatrix()),
38+ cachedDegreeMatrix (Graph<T>::getDegreeMatrix()),
39+ cachedLaplacianMatrix(Graph<T>::getLaplacianMatrix()),
40+ cachedTransitionMatrix(Graph<T>::getTransitionMatrix()) {}
4441
4542template <typename T>
46- Graph<T>::Graph(const T_EdgeSet<T> &edgeSet) {
47- for (auto edgeIt : edgeSet) {
48- this ->edgeSet .insert (edgeIt);
49- }
50- /* Caching the adjacency matrix */
51- cacheAdjMatrix ();
52- cacheDegreeMatrix ();
53- cacheLaplacianMatrix ();
54- cacheTransitionMatrix ();
55- }
43+ Graph<T>::Graph(const T_EdgeSet<T> &edgeSetToCopy)
44+ : edgeSet(edgeSetToCopy),
45+ cachedAdjMatrix (Graph<T>::getAdjMatrix()),
46+ cachedDegreeMatrix(Graph<T>::getDegreeMatrix()),
47+ cachedLaplacianMatrix(Graph<T>::getLaplacianMatrix()),
48+ cachedTransitionMatrix(Graph<T>::getTransitionMatrix()) {}
5649
5750template <typename T>
5851const T_EdgeSet<T> &Graph<T>::getEdgeSet() const {
You can’t perform that action at this time.
0 commit comments