Package fuzz :: Module fgraph :: Class FuzzyGraph
[hide private]
[frames] | no frames]

Class FuzzyGraph

source code

 object --+    
          |    
graph.Graph --+
              |
             FuzzyGraph

Fuzzy graph class.

Nested Classes [hide private]
  _setcls
Discrete fuzzy set class.
Instance Methods [hide private]
 
__init__(self, viter=None, eiter=None, directed=True)
Construct a fuzzy graph from optional iterables.
source code
 
add_vertex(self, vertex, mu=1.0)
Add a fuzzy vertex to the fuzzy graph, optionally constructing the vertex with the given membership degree.
source code
 
add_edge(self, edge, mu=1.0)
Add an edge to the fuzzy graph.
source code
set
vertices(self)
Return a set of vertices in the fuzzy graph.
source code
FuzzySet
edges(self, tail=None, head=None)
Return a fuzzy set of edges with tail and/or head optionally specified.
source code
float
mu(self, tail, head=None)
Return the membership degree of a vertex or edge.
source code
float
weight(self, tail, head)
Return the weight of an edge.
source code
 
connect(self, tail, head, mu=1.0)
Connect a pair of vertices with a new (fuzzy) edge.
source code
Graph
alpha(self, alpha)
Alpha cut function.
source code
Graph
salpha(self, alpha)
Strong alpha cut function.
source code
 
normalize(self)
Normalize the fuzzy graph by normalizing its vertex and edge sets.
source code

Inherited from graph.Graph: __eq__, __ge__, __gt__, __le__, __lt__, __ne__, __repr__, __str__, adjacent, connected, dijkstra, disconnect, edges_by_weight, floyd_warshall, issubgraph, issupergraph, minimum_spanning_tree, neighbors, remove_edge, remove_vertex, shortest_path, shortest_path_subgraph

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Static Methods [hide private]
 
_binary_sanity_check(other)
Check that the other argument to a binary operation is also a fuzzy graph, raising a TypeError otherwise.
source code
Properties [hide private]

Inherited from graph.Graph: directed

Inherited from object: __class__

Method Details [hide private]

__init__(self, viter=None, eiter=None, directed=True)
(Constructor)

source code 

Construct a fuzzy graph from optional iterables.

Parameters:
  • viter (object) - The iterable for the vertex set (optional).
  • eiter (object) - The iterable for the edge set (optional).
  • directed (bool) - Defines the graph as directed or undirected.
Overrides: object.__init__

add_vertex(self, vertex, mu=1.0)

source code 

Add a fuzzy vertex to the fuzzy graph, optionally constructing the vertex with the given membership degree.

Parameters:
  • vertex (object) - The vertex to add.
  • mu (float) - The membership degree of the vertex (optional).
Overrides: graph.Graph.add_vertex

add_edge(self, edge, mu=1.0)

source code 

Add an edge to the fuzzy graph.

Parameters:
  • edge (FuzzyElement of GraphEdge) - The edge to add.
  • mu (float) - The membership degree of the edge (optional).
Overrides: graph.Graph.add_edge

vertices(self)

source code 

Return a set of vertices in the fuzzy graph.

Returns: set
Overrides: graph.Graph.vertices

edges(self, tail=None, head=None)

source code 

Return a fuzzy set of edges with tail and/or head optionally specified.

Parameters:
  • tail (object) - The tail vertex constraint (optional).
  • head (object) - The head vertex constraint (optional).
Returns: FuzzySet
The fuzzy set of edges specified.
Overrides: graph.Graph.edges

mu(self, tail, head=None)

source code 

Return the membership degree of a vertex or edge.

Parameters:
  • tail (object) - The vertex or tail vertex.
  • head (object) - The head vertex.
Returns: float
The membership degree of the vertex or edge from tail to head.

weight(self, tail, head)

source code 

Return the weight of an edge. Returns the inverse of the membership degree for a fuzzy graph.

Parameters:
  • tail (object) - The tail vertex.
  • head (object) - The head vertex.
Returns: float
The weight of the edge from tail to head.
Overrides: graph.Graph.weight

connect(self, tail, head, mu=1.0)

source code 

Connect a pair of vertices with a new (fuzzy) edge.

Parameters:
  • tail (object) - The tail vertex.
  • head (object) - The head vertex.
  • mu (float) - The membership degree of the edge (optional).
Overrides: graph.Graph.connect

_binary_sanity_check(other)
Static Method

source code 

Check that the other argument to a binary operation is also a fuzzy graph, raising a TypeError otherwise.

Parameters:
Overrides: graph.Graph._binary_sanity_check

alpha(self, alpha)

source code 

Alpha cut function. Returns the crisp graph for which both vertex and edge membership values meet or exceed the alpha value.

Parameters:
  • alpha (float) - The alpha value for the cut in [0, 1].
Returns: Graph
The crisp graph result of the alpha cut.

salpha(self, alpha)

source code 

Strong alpha cut function. Returns the crisp graph for which both vertex and edge membership values exceed the alpha value.

Parameters:
  • alpha (float) - The alpha value for the cut in [0, 1].
Returns: Graph
The crisp graph result of the strong alpha cut.