Commit 0e1ad171 authored by Tiago Peixoto's avatar Tiago Peixoto

Remove redundant parameter for group/ungroup_vector_property

parent cab630fb
...@@ -528,7 +528,7 @@ def trust_transitivity(g, trust_map, source=None, target=None, vprop=None): ...@@ -528,7 +528,7 @@ def trust_transitivity(g, trust_map, source=None, target=None, vprop=None):
_prop("e", g, trust_map), _prop("e", g, trust_map),
_prop("v", g, vprop)) _prop("v", g, vprop))
if target != -1 or source != -1: if target != -1 or source != -1:
vprop = ungroup_vector_property(g, vprop, [0])[0] vprop = ungroup_vector_property(vprop, [0])[0]
if target != -1 and source != -1: if target != -1 and source != -1:
return vprop.a[target] return vprop.a[target]
return vprop return vprop
...@@ -290,6 +290,7 @@ def group_vector_property(props, value_type=None, vprop=None, pos=None): ...@@ -290,6 +290,7 @@ def group_vector_property(props, value_type=None, vprop=None, pos=None):
A vector property map with the grouped values of each property map in A vector property map with the grouped values of each property map in
``props``. ``props``.
""" """
g = props[0].get_graph()
vtypes = set() vtypes = set()
keys = set() keys = set()
for i, p in enumerate(props): for i, p in enumerate(props):
...@@ -335,14 +336,12 @@ def group_vector_property(props, value_type=None, vprop=None, pos=None): ...@@ -335,14 +336,12 @@ def group_vector_property(props, value_type=None, vprop=None, pos=None):
return vprop return vprop
def ungroup_vector_property(g, vprop, pos, props=None): def ungroup_vector_property(vprop, pos, props=None):
"""Ungroup vector property map ``vprop`` into a list of individual property """Ungroup vector property map ``vprop`` into a list of individual property
maps. maps.
Parameters Parameters
---------- ----------
g : :class:`~graph_tool.Graph`
Graph to which the property map belong.
vprop : :class:`~graph_tool.PropertyMap` vprop : :class:`~graph_tool.PropertyMap`
Vector property map to be ungrouped. Vector property map to be ungrouped.
pos : list of ints (optional, default: None) pos : list of ints (optional, default: None)
...@@ -358,6 +357,7 @@ def ungroup_vector_property(g, vprop, pos, props=None): ...@@ -358,6 +357,7 @@ def ungroup_vector_property(g, vprop, pos, props=None):
A list of property maps with the ungrouped values of ``vprop``. A list of property maps with the ungrouped values of ``vprop``.
""" """
g = vprop.get_graph()
_check_prop_vector(vprop, name="vprop", scalar=False) _check_prop_vector(vprop, name="vprop", scalar=False)
k = vprop.key_type() k = vprop.key_type()
value_type = vprop.value_type().split("<")[1].split(">")[0] value_type = vprop.value_type().split("<")[1].split(">")[0]
......
...@@ -281,7 +281,7 @@ def graph_draw(g, pos=None, size=(15, 15), pin=False, layout= "neato", ...@@ -281,7 +281,7 @@ def graph_draw(g, pos=None, size=(15, 15), pin=False, layout= "neato",
if pos != None: if pos != None:
# copy user-supplied property # copy user-supplied property
if isinstance(pos, PropertyMap): if isinstance(pos, PropertyMap):
pos = ungroup_vector_property(g, pos, [0,1]) pos = ungroup_vector_property(pos, [0,1])
else: else:
pos = (g.copy_property(pos[0]), g.copy_property(pos[1])) pos = (g.copy_property(pos[0]), g.copy_property(pos[1]))
...@@ -452,7 +452,7 @@ def graph_draw(g, pos=None, size=(15, 15), pin=False, layout= "neato", ...@@ -452,7 +452,7 @@ def graph_draw(g, pos=None, size=(15, 15), pin=False, layout= "neato",
pos[0].a /= 100 pos[0].a /= 100
pos[1].a /= 100 pos[1].a /= 100
pos = group_vector_property(g, pos) pos = group_vector_property(pos)
if return_bitmap: if return_bitmap:
# This is a not-so-nice hack which obtains an image buffer from a png # This is a not-so-nice hack which obtains an image buffer from a png
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment