Section for working with algorithms on fuzzy graphs

fuzzyops.graphs.algorithms.dominating.dominating_set.dominating_set(graph: FuzzyGraph) set[source]

Finds any dominant set in a given fuzzy graph

A dominant set is a subset of graph nodes such that each node of the graph either belongs to this subset or is adjacent to at least one node from this subset

Parameters:

graph (FuzzyGraph) – An instance of the fuzzy graph class

Returns:

The set of indexes of nodes included in the dominant set

Return type:

set

Raises:
  • Exception – An exception occurs if the passed graph is not an

  • instance of the `FuzzyGraph' class

fuzzyops.graphs.algorithms.dominating.fuzzy_dominating_set.fuzzy_dominating_set(graph: FuzzyGraph, number_value: GraphTriangleFuzzyNumber) set[source]

Finds the dominant set in a given fuzzy graph, where the connection between the nodes should be stronger than a given fuzzy number

A dominant set is a subset of graph nodes such that each node of the graph either belongs to this subset or is adjacent to at least one node from this subset However, unlike the usual dominant set, only connections that are stronger than a given fuzzy number are taken into account here

Parameters:
  • graph (FuzzyGraph) – An instance of the fuzzy graph class

  • number_value (GraphTriangleFuzzyNumber) – A fuzzy number that specifies the minimum strength of connections to include nodes in the dominant set

Returns:

The set of indexes of nodes included in the dominant set

Return type:

set

Raises:
  • Exception – An exception occurs if the passed graph is not an

  • instance of the `FuzzyGraph' class

fuzzyops.graphs.algorithms.dominating.is_dominating.is_dominating(graph: FuzzyGraph, nodes_set: set[int]) bool[source]

Checks whether a given set of nodes is dominant in a fuzzy graph

A dominant set is a subset of graph nodes such that each node of the graph either belongs to this subset or is adjacent to at least one node from this subset

Parameters:
  • graph (FuzzyGraph) – An instance of a fuzzy graph

  • nodes_set (set[int]) – There are many node indexes that need to be checked for dominance

Returns:

Returns True if `nodes_set’ is the dominant set

in the graph, otherwise it returns `False’

Return type:

bool

Raises:

Exception – An exception occurs if the passed graph is not an instance of the FuzzyGraph class or if the nodes_set is not a set There is also an exception if there are nodes in the nodes_set that are not in the graph

fuzzyops.graphs.algorithms.factoring.mle_clusterization_factors.mle_clusterization_factors(graph: FuzzyGraph, clusters_amount: int) List[int][source]

Performs clustering of nodes in a fuzzy graph using the MLE method

The likelihood maximization (MLE) method allows you to identify several clusters of nodes based on their relationships and values

Parameters:
  • graph (FuzzyGraph) – An instance of a fuzzy graph containing nodes for clustering

  • clusters_amount (int) – The number of clusters to split the nodes into

Returns:

A list of cluster indexes to which each node of the graph belongs

Return type:

List[int]

Raises:

Exception – An exception occurs if: - graph it is not an instance of the FuzzyGraph class - clusters_amount it is not an integer

fuzzyops.graphs.algorithms.transport.shortest_path.shortest_path(graph: FuzzyGraph, start_node: int, end_node: int) Dict[source]

Finds the shortest path between two given nodes in a fuzzy graph

Nodes are considered connected if there is a path between them, and its length is determined for this path. If the nodes are not connected, an exception is thrown

Parameters:
  • graph (FuzzyGraph) – An instance of a fuzzy graph in which a path must be found

  • start_node (int) – The index of the initial node

  • end_node (int) – The index of the end node

Returns:

A dictionary with two keys:
  • ’path’: List of nodes representing the shortest path from start_node to end_node

  • ’len’: The length of the shortest path

Return type:

Dict

Raises:

Exception – An exception occurs if: - The passed graph is not an instance of the FuzzyGraph class - The start or end node does not exist in the graph - The start and end nodes are not connected (i.e. there is no path between them)