dashapp.generate_graph_elements

Helper functions for the dashapp app.

Functions

create_graph(data)

Create a Cytoscape graph from the given data.

create_story_element(story)

Create a story element for the graph.

generate_edges(data)

Generate elements for each edge between clusters.

generate_graph_elements(data)

Generate elements for each edge between clusters.

generate_node_elements(data)

Generate elements for each cluster, represented by a node.

Classes

ClusterNodeElementData

The data for a cluster node element.

EdgeElement

An edge element for the graph.

EdgeElementData

The data for an edge element.

NodeElement

A cluster node element for the graph.

Point

A point for the graph.

StoryElement

A story element for the graph.

StoryElementData

The data for a story element.

class dashapp.generate_graph_elements.StoryElementData[source]

The data for a story element.

Parameters:
  • id – The story string ID.

  • number – The number of the story.

  • story – Whether the element is a story.

id: str
number: int
story: Literal[True]
class dashapp.generate_graph_elements.StoryElement[source]

A story element for the graph.

Parameters:
  • data – The is, number, and story number for the element.

  • classes – The classes for the element.

  • selectable – Whether the element is selectable.

data: StoryElementData
classes: str
selectable: Literal[False]
class dashapp.generate_graph_elements.ClusterNodeElementData[source]

The data for a cluster node element.

Parameters:
  • id – The cluster node ID.

  • parent – The parent node ID.

  • label – The label for the cluster node.

  • cluster_members – The cluster members.

id: str
parent: str | None
label: str
cluster_members: list[str]
summary: list[str]
class dashapp.generate_graph_elements.Point[source]

A point for the graph.

Parameters:
  • x – The x position for the point.

  • y – The y position for the point.

x: float
y: float
class dashapp.generate_graph_elements.NodeElement[source]

A cluster node element for the graph.

Parameters:
  • data – The id, parent, label, and cluster members for the element.

  • classes – The classes for the element.

  • position – The x and y position for the element.

data: ClusterNodeElementData
classes: str
position: Point
class dashapp.generate_graph_elements.EdgeElementData[source]

The data for an edge element.

Parameters:
  • id – The edge ID.

  • source – The source node ID.

  • target – The target node ID.

  • label – The label for the edge.

  • weight – The weight for the edge.

  • width – The width for the edge.

id: str
source: str
target: str
label: str
weight: float
width: float
directed: bool
class dashapp.generate_graph_elements.EdgeElement[source]

An edge element for the graph.

Parameters:
  • data – The id, source, target, label, weight, and width for the element.

  • classes – The classes for the element.

data: EdgeElementData
classes: str
dashapp.generate_graph_elements.create_story_element(story)[source]

Create a story element for the graph.

Parameters:

story (int) – The story number.

Return type:

StoryElement

Returns:

The story element.

dashapp.generate_graph_elements.generate_node_elements(data)[source]

Generate elements for each cluster, represented by a node.

:param data : The dataframe containing the graph data. :rtype: list[NodeElement] :return: The elements corresponding to the different clusters of documents.

dashapp.generate_graph_elements.generate_edges(data)[source]

Generate elements for each edge between clusters.

:param data : The dataframe containing the graph data. :rtype: list[EdgeElement] :return: The elements corresponding to the different clusters of documents.

dashapp.generate_graph_elements.generate_graph_elements(data)[source]

Generate elements for each edge between clusters.

:param data : The dataframe containing the graph data. :rtype: list[StoryElement | NodeElement | EdgeElement] :return: The elements for the graph.

dashapp.generate_graph_elements.create_graph(data)[source]

Create a Cytoscape graph from the given data.

Parameters:

data (DataFrame) – The data to create the graph from.

Return type:

Cytoscape

Returns:

The Cytoscape graph.