class_docstr: Class for constituency graph construction.
  
  ...
  
  Attributes
  ----------
  embedding_styles : (dict)
      Specify embedding styles including ``single_token_item``, ``emb_strategy``,
      ``num_rnn_layers``, ``bert_model_name`` and ``bert_lower_case``.
  
  vocab: (set, optional)
      Vocabulary including all words appeared in graphs.
  
  Methods
  -------
  
  topology(raw_text_data, nlp_processor, merge_strategy=None, edge_strategy=None)
      Generate graph structure with nlp parser like ``CoreNLP`` etc.
  
  _construct_static_graph(parsed_object, sub_sentence_id, edge_strategy=None)
      Construct a single static graph from a single sentence,
      to be called by ``topology`` function.
  
  _graph_connect(nx_graph_list, merge_strategy=None)
      Construct a merged graph from a list of graphs, to be called by ``topology`` function.
  
  embedding(node_attributes, edge_attributes)
      Generate node/edge embeddings from node/edge attributes through an embedding layer.
  
  forward(raw_text_data, nlp_parser)
      Generate graph topology and embeddings.
code: def _cut_line_node(cls, input_graph: GraphData):
      idx_to_be_deleted = []
      new_edges = []
      for idx, _ in enumerate(input_graph.node_attributes):
          edge_arr = input_graph.get_all_edges()
          cnt_in = 0
          cnt_out = 0
          for e in edge_arr:
              if idx == e[0]:
                  cnt_out += 1
                  out_ = e[1]
              if idx == e[1]:
                  cnt_in += 1
                  in_ = e[0]
          if cnt_in == 1 and cnt_out == 1:
              idx_to_be_deleted.append(idx)
              new_edges.append((in_, out_))
      if len(idx_to_be_deleted) == 0:
          return input_graph
      res_graph = GraphData()
      id_map = {}
      cnt_node = 0
      for idx, n in enumerate(input_graph.node_attributes):
          if idx not in idx_to_be_deleted:
              res_graph.add_nodes(1)
              res_graph.node_attributes[
                  res_graph.get_node_num() - 1
              ] = n
              id_map[idx] = cnt_node
              cnt_node += 1
          else:
              id_map[idx] = -1
      for edge_arr in input_graph.get_all_edges() + new_edges:
          if (edge_arr[0] not in idx_to_be_deleted) and (
              edge_arr[1] not in idx_to_be_deleted
          ):
              res_graph.add_edge(
                  id_map[edge_arr[0]], id_map[edge_arr[1]]
              )
      return res_graph
  
file_path: graph4nlp/graph4nlp/pytorch/modules/graph_construction/constituency_graph_construction.py
imports: import copy
  import json
  from pythonds.basic.stack import Stack
  from graph4nlp.pytorch.data.data import GraphData
  from .base import StaticGraphConstructionBase
  from .utils import CORENLP_TIMEOUT_SIGNATURE
label_desc: Use image node_id 6 for calling the ConstituencyBasedGraphConstruction obj's underlying member method code with example usage: obj._cut_line_node(cls, input_graph) and returns: res_graph, input_graph