FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
d-mercator/python/python_bind.cpp at main · networkgeometry/d-mercator · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
networkgeometry
/
d-mercator
Public
Notifications
You must be signed in to change notification settings
Fork
8
Star
23
Code
Issues
1
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
d-mercator
/
python
/
python_bind.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
131 lines (108 loc) · 2.87 KB
Breadcrumbs
d-mercator
/
python
/
python_bind.cpp
Copy path
File metadata and controls
131 lines (108 loc) · 2.87 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#
include
"
../include/embeddingSD.hpp
"
#
include
<
pybind11/pybind11.h
>
void
embed
(std::string edgelist_filename,
std::string rootname_output,
std::string already_inferred_parameters_filename,
bool
fast_mode,
bool
screen_mode,
bool
post_kappa,
bool
quiet_mode,
bool
validation_mode,
bool
clean_mode,
int
seed,
double
beta,
int
dimension)
{
//
Initialize graph object.
embeddingSD_t the_graph;
//
Sets the edgelist filename.
the_graph.
EDGELIST_FILENAME
= edgelist_filename;
//
Sets the output rootname.
if
(rootname_output.
length
() !=
0
)
{
the_graph.
CUSTOM_OUTPUT_ROOTNAME_MODE
=
true
;
the_graph.
ROOTNAME_OUTPUT
= rootname_output;
}
//
Activates the refine mode.
if
(already_inferred_parameters_filename.
length
() !=
0
)
{
the_graph.
REFINE_MODE
=
true
;
the_graph.
ALREADY_INFERRED_PARAMETERS_FILENAME
= already_inferred_parameters_filename;
}
//
Activates the fast mode.
if
(fast_mode)
{
the_graph.
MAXIMIZATION_MODE
=
false
;
}
//
Activates the validation mode.
if
(validation_mode)
{
the_graph.
VALIDATION_MODE
=
true
;
the_graph.
CHARACTERIZATION_MODE
=
true
;
}
//
Deactivates the post-processing of kappas.
if
(!post_kappa)
{
the_graph.
KAPPA_POST_INFERENCE_MODE
=
false
;
}
//
Activates the quiet mode.
if
(quiet_mode)
{
the_graph.
QUIET_MODE
=
true
;
}
//
Activates the clean mode.
if
(clean_mode)
{
the_graph.
CLEAN_RAW_OUTPUT_MODE
=
true
;
}
//
Activates the verbose mode.
if
(screen_mode)
{
the_graph.
VERBOSE_MODE
=
true
;
}
//
Sets a custom seed, if required.
if
(seed != -
1
)
{
the_graph.
CUSTOM_SEED
=
true
;
the_graph.
SEED
= seed;
}
//
Sets a custom value of beta, if required.
if
(beta != -
1
)
{
the_graph.
CUSTOM_BETA
=
true
;
the_graph.
beta
= beta;
}
//
Sets a value of dimension
the_graph.
DIMENSION
= dimension;
//
Performs the embedding.
the_graph.
embed
();
}
namespace
py
=
pybind11;
PYBIND11_MODULE
(dmercator, m) {
m.
doc
() =
R"pbdoc(
Pybind11 example plugin
-----------------------
.. currentmodule:: python_example
.. autosummary::
:toctree: _generate
embed
)pbdoc"
;
m.
def
(
"
embed
"
, &embed,
"
"
,
py::arg
(
"
edgelist_filename
"
),
py::arg
(
"
output_name
"
) =
"
"
,
py::arg
(
"
inf_coord
"
) =
"
"
,
py::arg
(
"
fast_mode
"
) =
false
,
py::arg
(
"
screen_mode
"
) =
false
,
py::arg
(
"
post_kappa
"
) =
true
,
py::arg
(
"
quiet_mode
"
) =
false
,
py::arg
(
"
validation_mode
"
) =
false
,
py::arg
(
"
clean_mode
"
) =
false
,
py::arg
(
"
seed
"
) = -
1
,
py::arg
(
"
beta
"
) = -
1
,
py::arg
(
"
dimension
"
) =
1
);
#
ifdef
VERSION_INFO
m.
attr
(
"
__version__
"
) =
VERSION_INFO
;
#
else
m.
attr
(
"
__version__
"
) =
"
dev
"
;
#
endif
}
Back
|
FazBrowse Home
|
New Git URL