@@ -715,18 +715,19 @@ def cells(self, data=False):
715715 else :
716716 yield cell , self .cell_attributes (cell )
717717
718- def vertices_where (self , conditions , data = False ):
718+ def vertices_where (self , conditions = None , data = False , ** kwargs ):
719719 """Get vertices for which a certain condition or set of conditions is true.
720720
721721 Parameters
722722 ----------
723- conditions : dict
723+ conditions : dict, optional
724724 A set of conditions in the form of key-value pairs.
725725 The keys should be attribute names. The values can be attribute
726726 values or ranges of attribute values in the form of min/max pairs.
727727 data : bool, optional
728- Yield the vertices and their data attributes.
729- Default is ``False``.
728+ If True, yield the vertex attributes in addition to the identifiers.
729+ **kwargs : dict[str, Any], optional
730+ Additional conditions provided as named function arguments.
730731
731732 Yields
732733 ------
@@ -735,6 +736,9 @@ def vertices_where(self, conditions, data=False):
735736 If `data` is True, the next vertex and its attributes.
736737
737738 """
739+ conditions = conditions or {}
740+ conditions .update (kwargs )
741+
738742 for key , attr in self .vertices (True ):
739743 is_match = True
740744
@@ -793,11 +797,10 @@ def vertices_where_predicate(self, predicate, data=False):
793797 Parameters
794798 ----------
795799 predicate : callable
796- The condition you want to evaluate. The callable takes 2 parameters:
797- ``key``, ``attr`` and should return `` True`` or `` False`` .
800+ The condition you want to evaluate.
801+ The callable takes 2 parameters: the vertex identifier and the vertex attributes, and should return True or False.
798802 data : bool, optional
799- Yield the vertices and their data attributes.
800- Default is ``False``.
803+ If True, yield the vertex attributes in addition to the identifiers.
801804
802805 Yields
803806 ------
@@ -813,18 +816,19 @@ def vertices_where_predicate(self, predicate, data=False):
813816 else :
814817 yield key
815818
816- def edges_where (self , conditions , data = False ):
819+ def edges_where (self , conditions = None , data = False , ** kwargs ):
817820 """Get edges for which a certain condition or set of conditions is true.
818821
819822 Parameters
820823 ----------
821- conditions : dict
824+ conditions : dict, optional
822825 A set of conditions in the form of key-value pairs.
823826 The keys should be attribute names. The values can be attribute
824827 values or ranges of attribute values in the form of min/max pairs.
825828 data : bool, optional
826- Yield the edges and their data attributes.
827- Default is ``False``.
829+ If True, yield the edge attributes in addition to the identifiers.
830+ **kwargs : dict[str, Any], optional
831+ Additional conditions provided as named function arguments.
828832
829833 Yields
830834 ------
@@ -833,6 +837,9 @@ def edges_where(self, conditions, data=False):
833837 If `data` is True, the next edge as a (u, v, data) tuple.
834838
835839 """
840+ conditions = conditions or {}
841+ conditions .update (kwargs )
842+
836843 for key in self .edges ():
837844 is_match = True
838845
@@ -875,11 +882,10 @@ def edges_where_predicate(self, predicate, data=False):
875882 Parameters
876883 ----------
877884 predicate : callable
878- The condition you want to evaluate. The callable takes 3 parameters:
879- ``u``, ``v``, ``attr`` and should return `` True`` or `` False`` .
885+ The condition you want to evaluate.
886+ The callable takes 2 parameters: the edge identifier and the edge attributes, and should return True or False.
880887 data : bool, optional
881- Yield the vertices and their data attributes.
882- Default is ``False``.
888+ If True, yield the edge attributes in addition to the identifiers.
883889
884890 Yields
885891 ------
@@ -895,18 +901,19 @@ def edges_where_predicate(self, predicate, data=False):
895901 else :
896902 yield key
897903
898- def faces_where (self , conditions , data = False ):
904+ def faces_where (self , conditions = None , data = False , ** kwargs ):
899905 """Get faces for which a certain condition or set of conditions is true.
900906
901907 Parameters
902908 ----------
903- conditions : dict
909+ conditions : dict, optional
904910 A set of conditions in the form of key-value pairs.
905911 The keys should be attribute names. The values can be attribute
906912 values or ranges of attribute values in the form of min/max pairs.
907913 data : bool, optional
908- Yield the faces and their data attributes.
909- Default is ``False``.
914+ If True, yield the face attributes in addition to the identifiers.
915+ **kwargs : dict[str, Any], optional
916+ Additional conditions provided as named function arguments.
910917
911918 Yields
912919 ------
@@ -915,6 +922,9 @@ def faces_where(self, conditions, data=False):
915922 If `data` is True, the next face and its attributes.
916923
917924 """
925+ conditions = conditions or {}
926+ conditions .update (kwargs )
927+
918928 for fkey in self .faces ():
919929 is_match = True
920930
@@ -957,11 +967,10 @@ def faces_where_predicate(self, predicate, data=False):
957967 Parameters
958968 ----------
959969 predicate : callable
960- The condition you want to evaluate. The callable takes 2 parameters:
961- ``key``, ``attr`` and should return `` True`` or `` False`` .
970+ The condition you want to evaluate.
971+ The callable takes 2 parameters: the face identifier and the the face attributes, and should return True or False.
962972 data : bool, optional
963- Yield the faces and their data attributes.
964- Default is ``False``.
973+ If True, yield the face attributes in addition to the identifiers.
965974
966975 Yields
967976 ------
@@ -977,18 +986,19 @@ def faces_where_predicate(self, predicate, data=False):
977986 else :
978987 yield fkey
979988
980- def cells_where (self , conditions , data = False ):
989+ def cells_where (self , conditions = None , data = False , ** kwargs ):
981990 """Get cells for which a certain condition or set of conditions is true.
982991
983992 Parameters
984993 ----------
985- conditions : dict
994+ conditions : dict, optional
986995 A set of conditions in the form of key-value pairs.
987996 The keys should be attribute names. The values can be attribute
988997 values or ranges of attribute values in the form of min/max pairs.
989998 data : bool, optional
990- Yield the cells and their data attributes.
991- Default is ``False``.
999+ If True, yield the cell attributes in addition to the identifiers.
1000+ **kwargs : dict[str, Any], optional
1001+ Additional conditions provided as named function arguments.
9921002
9931003 Yields
9941004 ------
@@ -997,6 +1007,9 @@ def cells_where(self, conditions, data=False):
9971007 If `data` is True, the next cell and its attributes.
9981008
9991009 """
1010+ conditions = conditions or {}
1011+ conditions .update (kwargs )
1012+
10001013 for ckey in self .cells ():
10011014 is_match = True
10021015
@@ -1039,11 +1052,10 @@ def cells_where_predicate(self, predicate, data=False):
10391052 Parameters
10401053 ----------
10411054 predicate : callable
1042- The condition you want to evaluate. The callable takes 2 parameters:
1043- ``key``, ``attr`` and should return `` True`` or `` False`` .
1055+ The condition you want to evaluate.
1056+ The callable takes 2 parameters: the cell identifier and the cell attributes, and should return True or False.
10441057 data : bool, optional
1045- Yield the cells and their data attributes.
1046- Default is ``False``.
1058+ If True, yield the cell attributes in addition to the identifiers.
10471059
10481060 Yields
10491061 ------
0 commit comments