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
566d6dd8
Commit
566d6dd8
authored
Jan 13, 2014
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix vertex/edge search with python::object properties
parent
2806a95d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
src/graph/util/graph_search.hh
src/graph/util/graph_search.hh
+10
-4
src/graph_tool/__init__.py
src/graph_tool/__init__.py
+2
-0
No files found.
src/graph/util/graph_search.hh
View file @
566d6dd8
...
...
@@ -73,6 +73,8 @@ struct find_vertices
nt
=
1
;
// python is not thread-safe
#endif
bool
is_eq
=
range
.
first
==
range
.
second
;
int
i
,
N
=
num_vertices
(
g
);
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100) \
num_threads(nt)
...
...
@@ -82,11 +84,12 @@ struct find_vertices
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
())
continue
;
value_type
val
=
deg
(
v
,
g
);
if
(
range
.
first
<=
val
&&
val
<=
range
.
second
)
if
((
is_eq
&&
(
val
==
range
.
first
))
||
(
!
is_eq
&&
(
range
.
first
<=
val
&&
val
<=
range
.
second
)))
{
PythonVertex
pv
(
pg
,
v
);
#pragma omp critical
{
#pragma omp critical
ret
.
append
(
pv
);
}
}
...
...
@@ -115,6 +118,8 @@ struct find_edges
nt
=
1
;
// python is not thread-safe
#endif
bool
is_eq
=
range
.
first
==
range
.
second
;
int
i
,
N
=
num_vertices
(
g
);
#pragma omp parallel for default(shared) private(i) schedule(static) if (N > 100) \
num_threads(nt)
...
...
@@ -135,11 +140,12 @@ struct find_edges
}
value_type
val
=
get
(
prop
,
*
e
);
if
(
range
.
first
<=
val
&&
val
<=
range
.
second
)
if
((
is_eq
&&
(
val
==
range
.
first
))
||
(
!
is_eq
&&
(
range
.
first
<=
val
&&
val
<=
range
.
second
)))
{
PythonEdge
<
Graph
>
pe
(
pg
,
*
e
);
#pragma omp critical
{
#pragma omp critical
ret
.
append
(
pe
);
}
}
...
...
src/graph_tool/__init__.py
View file @
566d6dd8
...
...
@@ -231,6 +231,8 @@ def _convert(prop, val):
vtype
=
_python_type
(
prop
.
value_type
())
if
type
(
vtype
)
is
tuple
:
return
[
vtype
[
1
](
x
)
for
x
in
val
]
if
vtype
is
object
:
return
val
return
vtype
(
val
)
...
...
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