Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
graph-tool
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tiago Peixoto
graph-tool
Commits
cdcadbfb
Commit
cdcadbfb
authored
Jul 29, 2020
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graph: fix vorder parameter when not contiguous
parent
66086427
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
src/graph/graph_copy.cc
src/graph/graph_copy.cc
+13
-1
src/graph_tool/__init__.py
src/graph_tool/__init__.py
+4
-2
src/graph_tool/inference/blockmodel.py
src/graph_tool/inference/blockmodel.py
+5
-1
No files found.
src/graph/graph_copy.cc
View file @
cdcadbfb
...
...
@@ -189,12 +189,24 @@ struct do_graph_copy
vector
<
pair
<
std
::
reference_wrapper
<
boost
::
any
>
,
std
::
reference_wrapper
<
boost
::
any
>>>&
vprops
,
vector
<
pair
<
std
::
reference_wrapper
<
boost
::
any
>
,
std
::
reference_wrapper
<
boost
::
any
>>>&
eprops
)
const
{
vector
<
size_t
>
vs
;
for
(
auto
v
:
vertices_range
(
src
))
vs
.
push_back
(
v
);
std
::
sort
(
vs
.
begin
(),
vs
.
end
(),
[
&
](
auto
u
,
auto
v
)
{
return
get
(
vertex_order
,
u
)
<
get
(
vertex_order
,
v
);
});
vector
<
size_t
>
pos
(
num_vertices
(
src
));
for
(
size_t
i
=
0
;
i
<
vs
.
size
();
++
i
)
pos
[
vs
[
i
]]
=
i
;
vector
<
size_t
>
index_map
(
num_vertices
(
src
));
for
(
auto
v
:
vertices_range
(
src
))
{
if
(
src_vertex_index
[
v
]
>=
index_map
.
size
())
index_map
.
resize
(
src_vertex_index
[
v
]
+
1
);
auto
new_v
=
get
(
vertex_order
,
v
)
;
auto
new_v
=
pos
[
v
]
;
while
(
size_t
(
new_v
)
>=
num_vertices
(
tgt
))
add_vertex
(
tgt
);
index_map
[
src_vertex_index
[
v
]]
=
tgt_vertex_index
[
new_v
];
...
...
src/graph_tool/__init__.py
View file @
cdcadbfb
...
...
@@ -1662,8 +1662,10 @@ class Graph(object):
# The vertex ordering
if
vorder
is
None
:
vorder
=
gv
.
new_vertex_property
(
"int"
)
vorder
.
fa
=
numpy
.
arange
(
gv
.
num_vertices
())
vorder
=
gv
.
new_vertex_property
(
"int"
,
vals
=
numpy
.
arange
(
gv
.
num_vertices
()))
else
:
vorder
=
vorder
.
copy
(
"int"
)
# The actual copying of the graph and property maps
self
.
__graph
=
libcore
.
GraphInterface
(
gv
.
__graph
,
False
,
...
...
src/graph_tool/inference/blockmodel.py
View file @
cdcadbfb
...
...
@@ -97,8 +97,12 @@ def get_block_graph(g, B, b, vcount=None, ecount=None, rec=None, drec=None):
cg
.
ep
[
"drec%d"
%
i
]
=
ae
[
0
]
del
ae
[
0
]
rs
=
numpy
.
setdiff1d
(
numpy
.
arange
(
B
,
dtype
=
"int"
),
br
.
fa
,
assume_unique
=
True
)
if
len
(
rs
)
>
0
:
cg
.
add_vertex
(
len
(
rs
))
br
.
fa
[
-
len
(
rs
):]
=
rs
cg
=
Graph
(
cg
,
vorder
=
br
)
cg
.
add_vertex
(
B
-
cg
.
num_vertices
())
cg
.
gp
.
rec
=
cg
.
new_gp
(
"object"
,
[])
if
rec
is
not
None
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment