graph¶
from instahashtag import Graph
Python wrapper for the Graph API call.
-
class
Graph¶ -
__init__(self, hashtag: str, aio: bool = False) → None¶ Initializes a new Graph object.
from instahashtag import Graph graph = Graph("miami")
-
hashtag¶ Hashtag that was used to retrieve information from.
graph.hashtag # >>> miami
-
exists¶ Boolean that dictates whether or not the passed hashtag exists.
graph.exists # >>> True
-
root_pos¶ List of floats indicating where the root position of the graph is.
graph.root_post # >>> [0.4495344797287565, 0.40752168227901403]
-
nodes¶ List of
GraphNodecontaining information on related hashtags.graph.nodes # >>> [Node(id=..., relevance=..., weight=..., x=..., y=...), ...] node = graph.nodes[0]
-
class
GraphNode(id: str, relevance: float, weight: float, x: float, y: float)¶ Object that represents the individual edges inside the
Graph.nodeslist.-
id¶ Hashtag name.
node.name # >>> liv
-
relevance¶ Relevance of the node.
node.relevance # >>> 0.5417327185029007
-
weight¶ Weight of the node.
node.weight # >>> 0.4523809523809524
-
x¶ Position of the node in relation to the x-axis.
node.x # >>> 0.20431805750484297
-
y¶ Position of the node in relation to the y-axis.
node.y # >>> 0.6194782200730474
-
-
class
-
edges¶ List of
GraphEdgecontaining information on the connection between hashtags.graph.edges # >>> [Edge(a=..., b=..., id=...#..., weight=...), ...] edge = graph.edges[0]
-
class
GraphEdge(a: str, b: str, id: str, weight: int)¶ Object that represents the individual edges inside the
Graph.edgeslist.-
a¶ Hashtag name that represents a node in the graph.
edge.a # >>> liv
-
b¶ Hashtag name that represents another node in the graph.
edge.a # >>> thingstodomiami
-
id¶ Order of the connection between nodes.
edge.id # >>> liv#thingstodomiami
-
weight¶ Weight of the edge.
edge.weight # >>> 0.44775669978922017
Note
The edge object of the graph represents which node is connected to which other node.
-
-
class
-
-