Construct a :class:`GraphDAGNode` object. Args: session (:class:`Session`): A graphscope session instance. incoming_data: Graph can be initialized through various type of sources, which can be one of: - :class:`graphscope.framework.op
(
self,
session,
incoming_data=None,
oid_type="int64",
vid_type="uint64",
directed=True,
generate_eid=True,
retain_oid=True,
vertex_map: Union[str, int] = "global",
compact_edges=False,
use_perfect_hash=False,
)
| 252 | """ |
| 253 | |
| 254 | def __init__( |
| 255 | self, |
| 256 | session, |
| 257 | incoming_data=None, |
| 258 | oid_type="int64", |
| 259 | vid_type="uint64", |
| 260 | directed=True, |
| 261 | generate_eid=True, |
| 262 | retain_oid=True, |
| 263 | vertex_map: Union[str, int] = "global", |
| 264 | compact_edges=False, |
| 265 | use_perfect_hash=False, |
| 266 | ): |
| 267 | """Construct a :class:`GraphDAGNode` object. |
| 268 | |
| 269 | Args: |
| 270 | session (:class:`Session`): A graphscope session instance. |
| 271 | incoming_data: Graph can be initialized through various type of sources, |
| 272 | which can be one of: |
| 273 | |
| 274 | - :class:`graphscope.framework.operation.Operation` |
| 275 | - :class:`graphscope.nx.Graph` |
| 276 | - :class:`graphscope.Graph` |
| 277 | - :class:`vineyard.Object`, :class:`vineyard.ObjectId` or :class:`vineyard.ObjectName` |
| 278 | |
| 279 | oid_type: (str, optional): Type of vertex original id. Defaults to "int64". |
| 280 | vid_type: (str, optional): Type of vertex internal id. Defaults to "uint64". |
| 281 | directed: (bool, optional): Directed graph or not. Defaults to True. |
| 282 | generate_eid: (bool, optional): Generate id for each edge when set True. Defaults to True. |
| 283 | retain_oid: (bool, optional): Keep original ID in vertex table when set True. Defaults to True. |
| 284 | vertex_map (str, optional): Indicate use global vertex map or local vertex map. Can be "global" or "local". |
| 285 | Defaults to global. |
| 286 | compact_edges (bool, optional): Compact edges (CSR) using varint and delta encoding. Defaults to False. |
| 287 | Note that compact edges helps to half the memory usage of edges in graph data structure, but may cause |
| 288 | at most 10%~20% performance degeneration in some algorithms. Defaults to False. |
| 289 | use_perfect_hash (bool, optional): Use perfect hash in vertex map to optimize the memory usage. Defaults to False. |
| 290 | """ |
| 291 | |
| 292 | super().__init__() |
| 293 | self._session = session |
| 294 | oid_type = utils.normalize_data_type_str(oid_type) |
| 295 | if oid_type not in ("int32_t", "int64_t", "std::string"): |
| 296 | raise ValueError("oid_type can only be int32_t, int64_t or string.") |
| 297 | vid_type = utils.normalize_data_type_str(vid_type) |
| 298 | if vid_type not in ("uint32_t", "uint64_t"): |
| 299 | raise ValueError("vid_type can only be uint32_t or uint64_t.") |
| 300 | self._oid_type = oid_type |
| 301 | self._vid_type = vid_type |
| 302 | self._directed = directed |
| 303 | self._generate_eid = generate_eid |
| 304 | self._retain_oid = retain_oid |
| 305 | self._graph_type = graph_def_pb2.ARROW_PROPERTY |
| 306 | self._vertex_map = utils.vertex_map_type_to_enum(vertex_map) |
| 307 | self._compact_edges = compact_edges |
| 308 | self._use_perfect_hash = use_perfect_hash |
| 309 | # for need to extend label in 'eager mode' when add_vertices and add_edges |
| 310 | # 0 - not extending label |
| 311 | # 1 - extend vertex label |
nothing calls this directly
no test coverage detected