topologicpy 0.4.62__py3-none-any.whl → 0.4.64__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- topologicpy/Cell.py +16 -1
- topologicpy/CellComplex.py +15 -1
- topologicpy/Cluster.py +30 -3
- topologicpy/DGL.py +54 -32
- topologicpy/EnergyModel.py +16 -13
- topologicpy/Face.py +15 -1
- topologicpy/Graph.py +64 -66
- topologicpy/Helper.py +17 -2
- topologicpy/Honeybee.py +31 -19
- topologicpy/Neo4j.py +7 -4
- topologicpy/Plotly.py +72 -23
- topologicpy/Polyskel.py +7 -7
- topologicpy/Shell.py +24 -31
- topologicpy/Topology.py +59 -51
- topologicpy/Vector.py +19 -3
- topologicpy/Vertex.py +16 -3
- topologicpy/Wire.py +0 -1
- topologicpy/__init__.py +1 -1
- {topologicpy-0.4.62.dist-info → topologicpy-0.4.64.dist-info}/METADATA +11 -1
- {topologicpy-0.4.62.dist-info → topologicpy-0.4.64.dist-info}/RECORD +23 -23
- {topologicpy-0.4.62.dist-info → topologicpy-0.4.64.dist-info}/LICENSE +0 -0
- {topologicpy-0.4.62.dist-info → topologicpy-0.4.64.dist-info}/WHEEL +0 -0
- {topologicpy-0.4.62.dist-info → topologicpy-0.4.64.dist-info}/top_level.txt +0 -0
topologicpy/Cell.py
CHANGED
|
@@ -3,7 +3,22 @@ import topologic
|
|
|
3
3
|
from topologicpy.Wire import Wire
|
|
4
4
|
from topologicpy.Topology import Topology
|
|
5
5
|
import math
|
|
6
|
-
|
|
6
|
+
import os
|
|
7
|
+
|
|
8
|
+
try:
|
|
9
|
+
import numpy as np
|
|
10
|
+
except:
|
|
11
|
+
print("Cell - Installing required numpy library.")
|
|
12
|
+
try:
|
|
13
|
+
os.system("pip install numpy")
|
|
14
|
+
except:
|
|
15
|
+
os.system("pip install numpy --user")
|
|
16
|
+
try:
|
|
17
|
+
import numpy as np
|
|
18
|
+
print("Cell - numpy library installed correctly.")
|
|
19
|
+
except:
|
|
20
|
+
raise Exception("Cell - Error: Could not import numpy.")
|
|
21
|
+
|
|
7
22
|
class Cell(Topology):
|
|
8
23
|
@staticmethod
|
|
9
24
|
def Area(cell: topologic.Cell, mantissa: int = 6) -> float:
|
topologicpy/CellComplex.py
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
import topologic
|
|
2
|
-
import warnings
|
|
3
2
|
import math
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
import numpy as np
|
|
7
|
+
except:
|
|
8
|
+
print("CellComplex - Installing required numpy library.")
|
|
9
|
+
try:
|
|
10
|
+
os.system("pip install numpy")
|
|
11
|
+
except:
|
|
12
|
+
os.system("pip install numpy --user")
|
|
13
|
+
try:
|
|
14
|
+
import numpy as np
|
|
15
|
+
print("CellComplex - numpy library installed correctly.")
|
|
16
|
+
except:
|
|
17
|
+
raise Exception("CellComplex - Error: Could not import numpy.")
|
|
4
18
|
|
|
5
19
|
class CellComplex(topologic.CellComplex):
|
|
6
20
|
@staticmethod
|
topologicpy/Cluster.py
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
import topologicpy
|
|
2
2
|
import topologic
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
import numpy as np
|
|
7
|
+
except:
|
|
8
|
+
print("Cluster - Installing required numpy library.")
|
|
9
|
+
try:
|
|
10
|
+
os.system("pip install numpy")
|
|
11
|
+
except:
|
|
12
|
+
os.system("pip install numpy --user")
|
|
13
|
+
try:
|
|
14
|
+
import numpy as np
|
|
15
|
+
print("Cluster - numpy library installed correctly.")
|
|
16
|
+
except:
|
|
17
|
+
raise Exception("Cluster - Error: Could not import numpy.")
|
|
18
|
+
|
|
19
|
+
try:
|
|
20
|
+
from scipy.spatial.distance import pdist, squareform
|
|
21
|
+
except:
|
|
22
|
+
print("Cluster - Installing required scipy library.")
|
|
23
|
+
try:
|
|
24
|
+
os.system("pip install scipy")
|
|
25
|
+
except:
|
|
26
|
+
os.system("pip install scipy --user")
|
|
27
|
+
try:
|
|
28
|
+
from scipy.spatial.distance import pdist, squareform
|
|
29
|
+
print("Cluster - scipy library installed correctly.")
|
|
30
|
+
except:
|
|
31
|
+
raise Exception("Cluster - Error: Could not import scipy.")
|
|
32
|
+
|
|
3
33
|
class Cluster(topologic.Cluster):
|
|
4
34
|
@staticmethod
|
|
5
35
|
def ByFormula(formula, xRange=None, yRange=None, xString="X", yString="Y"):
|
|
@@ -208,9 +238,6 @@ class Cluster(topologic.Cluster):
|
|
|
208
238
|
from topologicpy.Topology import Topology
|
|
209
239
|
from topologicpy.Dictionary import Dictionary
|
|
210
240
|
|
|
211
|
-
import numpy as np
|
|
212
|
-
from scipy.spatial.distance import pdist, squareform
|
|
213
|
-
|
|
214
241
|
def dbscan_3d_indices(data, eps, min_samples):
|
|
215
242
|
"""
|
|
216
243
|
DBSCAN clustering algorithm for 3D points.
|
topologicpy/DGL.py
CHANGED
|
@@ -1,33 +1,36 @@
|
|
|
1
|
-
import topologicpy
|
|
2
|
-
import topologic
|
|
3
|
-
from topologicpy.Dictionary import Dictionary
|
|
4
1
|
import os
|
|
5
2
|
import random
|
|
6
|
-
import time
|
|
7
|
-
from datetime import datetime
|
|
8
3
|
import copy
|
|
9
|
-
import sys
|
|
10
|
-
import subprocess
|
|
11
4
|
os.environ["DGLBACKEND"] = "pytorch"
|
|
12
5
|
|
|
13
6
|
try:
|
|
14
7
|
import numpy as np
|
|
15
8
|
except:
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
print("DGL - Installing required numpy library.")
|
|
10
|
+
try:
|
|
11
|
+
os.system("pip install numpy")
|
|
12
|
+
except:
|
|
13
|
+
os.system("pip install numpy --user")
|
|
18
14
|
try:
|
|
19
15
|
import numpy as np
|
|
16
|
+
print("DGL - numpy library installed correctly.")
|
|
20
17
|
except:
|
|
21
|
-
|
|
18
|
+
raise Exception("DGL - Error: Could not import numpy.")
|
|
19
|
+
|
|
22
20
|
try:
|
|
23
21
|
import pandas as pd
|
|
24
22
|
except:
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
print("DGL - Installing required pandas library.")
|
|
24
|
+
try:
|
|
25
|
+
os.system("pip install pandas")
|
|
26
|
+
except:
|
|
27
|
+
os.system("pip install pandas --user")
|
|
27
28
|
try:
|
|
28
29
|
import pandas as pd
|
|
30
|
+
print("DGL - pandas library installed correctly.")
|
|
29
31
|
except:
|
|
30
|
-
|
|
32
|
+
raise Exception("DGL - Error: Could not import pandas.")
|
|
33
|
+
|
|
31
34
|
try:
|
|
32
35
|
import torch
|
|
33
36
|
import torch.nn as nn
|
|
@@ -35,16 +38,21 @@ try:
|
|
|
35
38
|
from torch.utils.data.sampler import SubsetRandomSampler
|
|
36
39
|
from torch.utils.data import DataLoader, ConcatDataset
|
|
37
40
|
except:
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
print("DGL - Installing required torch library.")
|
|
42
|
+
try:
|
|
43
|
+
os.system("pip install torch")
|
|
44
|
+
except:
|
|
45
|
+
os.system("pip install torch --user")
|
|
40
46
|
try:
|
|
41
47
|
import torch
|
|
42
48
|
import torch.nn as nn
|
|
43
49
|
import torch.nn.functional as F
|
|
44
50
|
from torch.utils.data.sampler import SubsetRandomSampler
|
|
45
51
|
from torch.utils.data import DataLoader, ConcatDataset
|
|
52
|
+
print("DGL - torch library installed correctly.")
|
|
46
53
|
except:
|
|
47
|
-
|
|
54
|
+
raise Exception("DGL - Error: Could not import torch.")
|
|
55
|
+
|
|
48
56
|
try:
|
|
49
57
|
import dgl
|
|
50
58
|
from dgl.data import DGLDataset
|
|
@@ -52,37 +60,54 @@ try:
|
|
|
52
60
|
from dgl.nn import GINConv, GraphConv, SAGEConv, TAGConv
|
|
53
61
|
from dgl import save_graphs, load_graphs
|
|
54
62
|
except:
|
|
55
|
-
|
|
56
|
-
|
|
63
|
+
print("DGL - Installing required dgl library.")
|
|
64
|
+
try:
|
|
65
|
+
os.system("pip install dgl -f https://data.dgl.ai/wheels/repo.html")
|
|
66
|
+
os.system("pip install dglgo -f https://data.dgl.ai/wheels-test/repo.html")
|
|
67
|
+
except:
|
|
68
|
+
os.system("pip install dgl -f https://data.dgl.ai/wheels/repo.html --user")
|
|
69
|
+
os.system("pip install dglgo -f https://data.dgl.ai/wheels-test/repo.html --user")
|
|
57
70
|
try:
|
|
58
71
|
import dgl
|
|
59
72
|
from dgl.data import DGLDataset
|
|
60
|
-
from dgl.
|
|
73
|
+
from dgl.dataloading import GraphDataLoader
|
|
74
|
+
from dgl.nn import GINConv, GraphConv, SAGEConv, TAGConv
|
|
61
75
|
from dgl import save_graphs, load_graphs
|
|
76
|
+
print("DGL - dgl library installed correctly.")
|
|
62
77
|
except:
|
|
63
|
-
|
|
78
|
+
raise Exception("DGL - Error: Could not import dgl. The installation of the correct version of the dgl library is not trivial and is highly dependent on your hardward and software configuration. Please consult the dgl installation instructions.")
|
|
79
|
+
|
|
64
80
|
try:
|
|
65
|
-
import
|
|
81
|
+
from sklearn import metrics
|
|
66
82
|
from sklearn.model_selection import KFold
|
|
67
83
|
from sklearn.metrics import accuracy_score
|
|
68
84
|
except:
|
|
69
|
-
|
|
70
|
-
|
|
85
|
+
print("DGL - Installing required scikit-learn (sklearn) library.")
|
|
86
|
+
try:
|
|
87
|
+
os.system("pip install scikit-learn")
|
|
88
|
+
except:
|
|
89
|
+
os.system("pip install scikit-learn --user")
|
|
71
90
|
try:
|
|
72
|
-
import
|
|
91
|
+
from sklearn import metrics
|
|
73
92
|
from sklearn.model_selection import KFold
|
|
74
93
|
from sklearn.metrics import accuracy_score
|
|
94
|
+
print("DGL - scikit-learn (sklearn) library installed correctly.")
|
|
75
95
|
except:
|
|
76
|
-
|
|
96
|
+
raise Exception("DGL - Error: Could not import scikit-learn (sklearn).")
|
|
97
|
+
|
|
77
98
|
try:
|
|
78
99
|
from tqdm.auto import tqdm
|
|
79
100
|
except:
|
|
80
|
-
|
|
81
|
-
|
|
101
|
+
print("DGL - Installing required tqdm library.")
|
|
102
|
+
try:
|
|
103
|
+
os.system("pip install tqdm")
|
|
104
|
+
except:
|
|
105
|
+
os.system("pip install tqdm --user")
|
|
82
106
|
try:
|
|
83
107
|
from tqdm.auto import tqdm
|
|
108
|
+
print("DGL - tqdm library installed correctly.")
|
|
84
109
|
except:
|
|
85
|
-
|
|
110
|
+
raise Exception("DGL - Error: Could not import tqdm.")
|
|
86
111
|
|
|
87
112
|
class _Dataset(DGLDataset):
|
|
88
113
|
def __init__(self, graphs, labels, node_attr_key, edge_attr_key):
|
|
@@ -1431,8 +1456,6 @@ class DGL:
|
|
|
1431
1456
|
The dictionary containing the performance measures. The keys in the dictionary are: 'mae', 'mape', 'mse', 'r', 'r2', 'rmse', .
|
|
1432
1457
|
"""
|
|
1433
1458
|
|
|
1434
|
-
import numpy as np
|
|
1435
|
-
|
|
1436
1459
|
if not isinstance(actual, list):
|
|
1437
1460
|
print("DGL.Performance - ERROR: The actual input is not a list. Returning None")
|
|
1438
1461
|
return None
|
|
@@ -1683,8 +1706,7 @@ class DGL:
|
|
|
1683
1706
|
The created confusion matrix.
|
|
1684
1707
|
|
|
1685
1708
|
"""
|
|
1686
|
-
|
|
1687
|
-
import numpy
|
|
1709
|
+
|
|
1688
1710
|
if not isinstance(actual, list):
|
|
1689
1711
|
print("DGL.ConfusionMatrix - ERROR: The actual input is not a list. Returning None")
|
|
1690
1712
|
return None
|
topologicpy/EnergyModel.py
CHANGED
|
@@ -1,40 +1,43 @@
|
|
|
1
1
|
import topologicpy
|
|
2
2
|
import topologic
|
|
3
|
-
from topologicpy.Topology import Topology
|
|
4
|
-
from topologicpy.Dictionary import Dictionary
|
|
5
3
|
|
|
6
4
|
import shutil
|
|
7
5
|
import math
|
|
8
6
|
from collections import OrderedDict
|
|
9
7
|
import os
|
|
10
8
|
from os.path import exists
|
|
11
|
-
import json
|
|
12
9
|
from datetime import datetime
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import subprocess
|
|
10
|
+
|
|
11
|
+
|
|
16
12
|
try:
|
|
17
13
|
from tqdm.auto import tqdm
|
|
18
14
|
except:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
print("EnergyModel - Installing required tqdm library.")
|
|
16
|
+
try:
|
|
17
|
+
os.system("pip install tqdm")
|
|
18
|
+
except:
|
|
19
|
+
os.system("pip install tqdm --user")
|
|
22
20
|
try:
|
|
23
21
|
from tqdm.auto import tqdm
|
|
22
|
+
print("EnergyModel - tqdm library installed correctly.")
|
|
24
23
|
except:
|
|
25
|
-
|
|
24
|
+
raise Exception("EnergyModel - Error: Could not import tqdm.")
|
|
26
25
|
|
|
27
26
|
try:
|
|
28
27
|
import openstudio
|
|
29
28
|
openstudio.Logger.instance().standardOutLogger().setLogLevel(openstudio.Fatal)
|
|
30
29
|
except:
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
print("EnergyModel - Installing required openstudio library.")
|
|
31
|
+
try:
|
|
32
|
+
os.system("pip install openstudio")
|
|
33
|
+
except:
|
|
34
|
+
os.system("pip install openstudio --user")
|
|
33
35
|
try:
|
|
34
36
|
import openstudio
|
|
35
37
|
openstudio.Logger.instance().standardOutLogger().setLogLevel(openstudio.Fatal)
|
|
38
|
+
print("EnergyModel - openstudio library installed correctly.")
|
|
36
39
|
except:
|
|
37
|
-
|
|
40
|
+
raise Exception("EnergyModel - Error: Could not import openstudio.")
|
|
38
41
|
|
|
39
42
|
class EnergyModel:
|
|
40
43
|
'''
|
topologicpy/Face.py
CHANGED
|
@@ -3,6 +3,21 @@ import topologic
|
|
|
3
3
|
from topologicpy.Vector import Vector
|
|
4
4
|
from topologicpy.Wire import Wire
|
|
5
5
|
import math
|
|
6
|
+
import os
|
|
7
|
+
|
|
8
|
+
try:
|
|
9
|
+
import numpy as np
|
|
10
|
+
except:
|
|
11
|
+
print("Face - Installing required numpy library.")
|
|
12
|
+
try:
|
|
13
|
+
os.system("pip install numpy")
|
|
14
|
+
except:
|
|
15
|
+
os.system("pip install numpy --user")
|
|
16
|
+
try:
|
|
17
|
+
import numpy as np
|
|
18
|
+
print("Face - numpy library installed correctly.")
|
|
19
|
+
except:
|
|
20
|
+
raise Exception("Face - Error: Could not import numpy.")
|
|
6
21
|
|
|
7
22
|
class Face(topologic.Face):
|
|
8
23
|
@staticmethod
|
|
@@ -1644,7 +1659,6 @@ class Face(topologic.Face):
|
|
|
1644
1659
|
|
|
1645
1660
|
@staticmethod
|
|
1646
1661
|
def RectangleByPlaneEquation(origin: topologic.Vertex = None, width: float = 1.0, length: float = 1.0, placement: str = "center", equation: dict = None, tolerance: float = 0.0001) -> topologic.Face:
|
|
1647
|
-
import numpy as np
|
|
1648
1662
|
from topologicpy.Vertex import Vertex
|
|
1649
1663
|
# Extract coefficients of the plane equation
|
|
1650
1664
|
a = equation['a']
|
topologicpy/Graph.py
CHANGED
|
@@ -8,35 +8,77 @@ import random
|
|
|
8
8
|
import time
|
|
9
9
|
import sys
|
|
10
10
|
import subprocess
|
|
11
|
+
import os
|
|
12
|
+
|
|
11
13
|
try:
|
|
12
|
-
|
|
14
|
+
import numpy as np
|
|
13
15
|
except:
|
|
14
|
-
|
|
15
|
-
subprocess.run(call)
|
|
16
|
+
print("Graph - Installing required numpy library.")
|
|
16
17
|
try:
|
|
17
|
-
|
|
18
|
+
os.system("pip install numpy")
|
|
18
19
|
except:
|
|
19
|
-
|
|
20
|
+
os.system("pip install numpy --user")
|
|
21
|
+
try:
|
|
22
|
+
import numpy as np
|
|
23
|
+
print("Graph - numpy library installed correctly.")
|
|
24
|
+
except:
|
|
25
|
+
raise Exception("Graph - Error: Could not import numpy.")
|
|
20
26
|
|
|
21
27
|
try:
|
|
22
|
-
import
|
|
28
|
+
import pandas as pd
|
|
23
29
|
except:
|
|
24
|
-
|
|
25
|
-
subprocess.run(call)
|
|
30
|
+
print("Graph - Installing required pandas library.")
|
|
26
31
|
try:
|
|
27
|
-
|
|
32
|
+
os.system("pip install pandas")
|
|
33
|
+
except:
|
|
34
|
+
os.system("pip install pandas --user")
|
|
35
|
+
try:
|
|
36
|
+
import pandas as pd
|
|
37
|
+
print("Graph - pandas library installed correctly.")
|
|
38
|
+
except:
|
|
39
|
+
raise Exception("Graph - Error: Could not import pandas.")
|
|
40
|
+
|
|
41
|
+
try:
|
|
42
|
+
from tqdm.auto import tqdm
|
|
43
|
+
except:
|
|
44
|
+
print("Graph - Installing required tqdm library.")
|
|
45
|
+
try:
|
|
46
|
+
os.system("pip install tqdm")
|
|
47
|
+
except:
|
|
48
|
+
os.system("pip install tqdm --user")
|
|
49
|
+
try:
|
|
50
|
+
from tqdm.auto import tqdm
|
|
51
|
+
print("Graph - tqdm library installed correctly.")
|
|
28
52
|
except:
|
|
29
|
-
|
|
53
|
+
raise Exception("Graph - Error: Could not import tqdm.")
|
|
30
54
|
|
|
31
55
|
try:
|
|
32
56
|
from pyvis.network import Network
|
|
33
57
|
except:
|
|
34
|
-
|
|
35
|
-
|
|
58
|
+
print("Graph - Installing required pyvis library.")
|
|
59
|
+
try:
|
|
60
|
+
os.system("pip install pyvis")
|
|
61
|
+
except:
|
|
62
|
+
os.system("pip install pyvis --user")
|
|
36
63
|
try:
|
|
37
64
|
from pyvis.network import Network
|
|
65
|
+
print("Graph - pyvis library installed correctly.")
|
|
66
|
+
except:
|
|
67
|
+
raise Exception("Graph - Error: Could not import pyvis")
|
|
68
|
+
|
|
69
|
+
try:
|
|
70
|
+
import networkx as nx
|
|
71
|
+
except:
|
|
72
|
+
print("Graph - Installing required networkx library.")
|
|
73
|
+
try:
|
|
74
|
+
os.system("pip install networkx")
|
|
75
|
+
except:
|
|
76
|
+
os.system("pip install networkx --user")
|
|
77
|
+
try:
|
|
78
|
+
import networkx as nx
|
|
79
|
+
print("Graph - networkx library installed correctly.")
|
|
38
80
|
except:
|
|
39
|
-
|
|
81
|
+
raise Exception("Graph - Error: Could not import networkx.")
|
|
40
82
|
|
|
41
83
|
class _Tree:
|
|
42
84
|
def __init__(self, node="", *children):
|
|
@@ -472,16 +514,6 @@ class Graph:
|
|
|
472
514
|
returnList[index] = returnList[index]+1
|
|
473
515
|
return returnList
|
|
474
516
|
|
|
475
|
-
try:
|
|
476
|
-
from tqdm.auto import tqdm
|
|
477
|
-
except:
|
|
478
|
-
call = [sys.executable, '-m', 'pip', 'install', 'tqdm', '-t', sys.path[0]]
|
|
479
|
-
subprocess.run(call)
|
|
480
|
-
try:
|
|
481
|
-
from tqdm.auto import tqdm
|
|
482
|
-
except:
|
|
483
|
-
print("Graph.BetweenessCentrality - Error: Could not import tqdm")
|
|
484
|
-
|
|
485
517
|
if not isinstance(graph, topologic.Graph):
|
|
486
518
|
print("Graph.BetweenessCentrality - Error: The input graph is not a valid graph. Returning None.")
|
|
487
519
|
return None
|
|
@@ -551,7 +583,7 @@ class Graph:
|
|
|
551
583
|
The created graph.
|
|
552
584
|
|
|
553
585
|
"""
|
|
554
|
-
|
|
586
|
+
|
|
555
587
|
# Read the adjacency matrix from CSV file using pandas
|
|
556
588
|
adjacency_matrix_df = pd.read_csv(path, header=None)
|
|
557
589
|
|
|
@@ -682,7 +714,6 @@ class Graph:
|
|
|
682
714
|
from topologicpy.Edge import Edge
|
|
683
715
|
from topologicpy.Topology import Topology
|
|
684
716
|
from topologicpy.Dictionary import Dictionary
|
|
685
|
-
import pandas as pd
|
|
686
717
|
import os
|
|
687
718
|
from os.path import exists, isdir
|
|
688
719
|
import yaml
|
|
@@ -2791,18 +2822,6 @@ class Graph:
|
|
|
2791
2822
|
The closeness centrality of the input list of vertices within the input graph. The values are in the range 0 to 1.
|
|
2792
2823
|
|
|
2793
2824
|
"""
|
|
2794
|
-
import sys
|
|
2795
|
-
import subprocess
|
|
2796
|
-
|
|
2797
|
-
try:
|
|
2798
|
-
from tqdm.auto import tqdm
|
|
2799
|
-
except:
|
|
2800
|
-
call = [sys.executable, '-m', 'pip', 'install', 'tqdm', '-t', sys.path[0]]
|
|
2801
|
-
subprocess.run(call)
|
|
2802
|
-
try:
|
|
2803
|
-
from tqdm.auto import tqdm
|
|
2804
|
-
except:
|
|
2805
|
-
print("DGL - Error: Could not import tqdm")
|
|
2806
2825
|
|
|
2807
2826
|
if not isinstance(graph, topologic.Graph):
|
|
2808
2827
|
print("Graph.ClosenessCentrality - Error: The input graph is not a valid graph. Returning None.")
|
|
@@ -3188,7 +3207,6 @@ class Graph:
|
|
|
3188
3207
|
----------
|
|
3189
3208
|
path : str
|
|
3190
3209
|
The desired path to the output folder where the graphs, edges, and nodes CSV files will be saved.
|
|
3191
|
-
import pandas as pd
|
|
3192
3210
|
|
|
3193
3211
|
Returns
|
|
3194
3212
|
-------
|
|
@@ -3196,7 +3214,6 @@ class Graph:
|
|
|
3196
3214
|
True if the graph has been successfully exported. False otherwise.
|
|
3197
3215
|
|
|
3198
3216
|
"""
|
|
3199
|
-
import pandas as pd
|
|
3200
3217
|
|
|
3201
3218
|
# Convert the adjacency matrix (nested list) to a DataFrame
|
|
3202
3219
|
adjacency_matrix_df = pd.DataFrame(adjacencyMatrix)
|
|
@@ -3327,7 +3344,6 @@ class Graph:
|
|
|
3327
3344
|
import os
|
|
3328
3345
|
import math
|
|
3329
3346
|
import random
|
|
3330
|
-
import pandas as pd
|
|
3331
3347
|
import os
|
|
3332
3348
|
from os.path import exists
|
|
3333
3349
|
|
|
@@ -4517,16 +4533,6 @@ class Graph:
|
|
|
4517
4533
|
if not isinstance(graph, topologic.Graph):
|
|
4518
4534
|
print("Graph.NetworkXGraph - Error: The input graph is not a valid graph. Returning None.")
|
|
4519
4535
|
return None
|
|
4520
|
-
try:
|
|
4521
|
-
import networkx as nx
|
|
4522
|
-
except:
|
|
4523
|
-
call = [sys.executable, '-m', 'pip', 'install', 'networkx', '-t', sys.path[0]]
|
|
4524
|
-
subprocess.run(call)
|
|
4525
|
-
try:
|
|
4526
|
-
import networkx as nx
|
|
4527
|
-
except:
|
|
4528
|
-
print("Graph.NetworkXGraph - ERROR: Could not import networkx. Returning None.")
|
|
4529
|
-
return None
|
|
4530
4536
|
|
|
4531
4537
|
nxGraph = nx.Graph()
|
|
4532
4538
|
vertices = Graph.Vertices(graph)
|
|
@@ -5009,7 +5015,7 @@ class Graph:
|
|
|
5009
5015
|
@staticmethod
|
|
5010
5016
|
def Show(graph, vertexColor="black", vertexSize=6, vertexLabelKey=None, vertexGroupKey=None, vertexGroups=[], showVertices=True, showVertexLegend=False, edgeColor="black", edgeWidth=1, edgeLabelKey=None, edgeGroupKey=None, edgeGroups=[], showEdges=True, showEdgeLegend=False, colorScale='viridis', renderer="notebook",
|
|
5011
5017
|
width=950, height=500, xAxis=False, yAxis=False, zAxis=False, axisSize=1, backgroundColor='rgba(0,0,0,0)', marginLeft=0, marginRight=0, marginTop=20, marginBottom=0,
|
|
5012
|
-
camera=
|
|
5018
|
+
camera=[-1.25, -1.25, 1.25], center=[0, 0, 0], up=[0, 0, 1], projection="perspective", tolerance=0.0001):
|
|
5013
5019
|
"""
|
|
5014
5020
|
Shows the graph using Plotly.
|
|
5015
5021
|
|
|
@@ -5088,11 +5094,14 @@ class Graph:
|
|
|
5088
5094
|
marginBottom : int , optional
|
|
5089
5095
|
The size in pixels of the bottom margin. The default value is 0.
|
|
5090
5096
|
camera : list , optional
|
|
5091
|
-
The desired location of the camera. The default is [
|
|
5092
|
-
|
|
5093
|
-
The desired camera target. The default is [0,0,0].
|
|
5097
|
+
The desired location of the camera). The default is [-1.25,-1.25,1.25].
|
|
5098
|
+
center : list , optional
|
|
5099
|
+
The desired center (camera target). The default is [0,0,0].
|
|
5094
5100
|
up : list , optional
|
|
5095
5101
|
The desired up vector. The default is [0,0,1].
|
|
5102
|
+
projection : str , optional
|
|
5103
|
+
The desired type of projection. The options are "orthographic" or "perspective". It is case insensitive. The default is "perspective"
|
|
5104
|
+
|
|
5096
5105
|
tolerance : float , optional
|
|
5097
5106
|
The desired tolerance. The default is 0.0001.
|
|
5098
5107
|
|
|
@@ -5110,7 +5119,7 @@ class Graph:
|
|
|
5110
5119
|
data= Plotly.DataByGraph(graph, vertexColor=vertexColor, vertexSize=vertexSize, vertexLabelKey=vertexLabelKey, vertexGroupKey=vertexGroupKey, vertexGroups=vertexGroups, showVertices=showVertices, showVertexLegend=showVertexLegend, edgeColor=edgeColor, edgeWidth=edgeWidth, edgeLabelKey=edgeLabelKey, edgeGroupKey=edgeGroupKey, edgeGroups=edgeGroups, showEdges=showEdges, showEdgeLegend=showEdgeLegend, colorScale=colorScale)
|
|
5111
5120
|
fig = Plotly.FigureByData(data, width=width, height=height, xAxis=xAxis, yAxis=yAxis, zAxis=zAxis, axisSize=axisSize, backgroundColor=backgroundColor,
|
|
5112
5121
|
marginLeft=marginLeft, marginRight=marginRight, marginTop=marginTop, marginBottom=marginBottom, tolerance=tolerance)
|
|
5113
|
-
Plotly.Show(fig, renderer=renderer, camera=camera,
|
|
5122
|
+
Plotly.Show(fig, renderer=renderer, camera=camera, center=center, up=up, projection=projection)
|
|
5114
5123
|
|
|
5115
5124
|
@staticmethod
|
|
5116
5125
|
def Size(graph):
|
|
@@ -5342,17 +5351,6 @@ class Graph:
|
|
|
5342
5351
|
from topologicpy.Wire import Wire
|
|
5343
5352
|
from topologicpy.Cluster import Cluster
|
|
5344
5353
|
from topologicpy.Topology import Topology
|
|
5345
|
-
import sys
|
|
5346
|
-
import subprocess
|
|
5347
|
-
try:
|
|
5348
|
-
from tqdm.auto import tqdm
|
|
5349
|
-
except:
|
|
5350
|
-
call = [sys.executable, '-m', 'pip', 'install', 'tqdm', '-t', sys.path[0]]
|
|
5351
|
-
subprocess.run(call)
|
|
5352
|
-
try:
|
|
5353
|
-
from tqdm.auto import tqdm
|
|
5354
|
-
except:
|
|
5355
|
-
print("Graph.VisibilityGraph - Error: Could not import tqdm")
|
|
5356
5354
|
|
|
5357
5355
|
def addEdge(edge, edges, viewpointsA, viewpointsB, tolerance=0.0001):
|
|
5358
5356
|
# Add edge to edges only if its end points are in vertices
|
topologicpy/Helper.py
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
import topologicpy
|
|
2
|
-
import numpy as np
|
|
3
|
-
import numpy.linalg as la
|
|
4
2
|
import math
|
|
3
|
+
import os
|
|
4
|
+
|
|
5
|
+
try:
|
|
6
|
+
import numpy as np
|
|
7
|
+
import numpy.linalg as la
|
|
8
|
+
except:
|
|
9
|
+
print("Helper - Installing required numpy library.")
|
|
10
|
+
try:
|
|
11
|
+
os.system("pip install numpy")
|
|
12
|
+
except:
|
|
13
|
+
os.system("pip install numpy --user")
|
|
14
|
+
try:
|
|
15
|
+
import numpy as np
|
|
16
|
+
import numpy.linalg as la
|
|
17
|
+
print("Helper - numpy library installed correctly.")
|
|
18
|
+
except:
|
|
19
|
+
raise Exception("Helper - Error: Could not import numpy.")
|
|
5
20
|
|
|
6
21
|
class Helper:
|
|
7
22
|
@staticmethod
|