code: def _load_cora_or_citeseer(
      dataset,
      directed,
      largest_connected_component_only,
      subject_as_feature,
      edge_weights,
      nodes_dtype,
  ):
      assert isinstance(dataset, (Cora, CiteSeer))
  
      if nodes_dtype is None:
          nodes_dtype = dataset._NODES_DTYPE
  
      dataset.download()
  
      # expected_files should be in this order
      cites, content = [
          dataset._resolve_path(name) for name in dataset.expected_files
      ]
  
      feature_names = [
          "w_{}".format(ii) for ii in range(dataset._NUM_FEATURES)
      ]
      subject = "subject"
      if subject_as_feature:
          feature_names.append(subject)
          column_names = feature_names
      else:
          column_names = feature_names + [subject]
  
      node_data = pd.read_csv(
          content,
          sep="\t",
          header=None,
          names=column_names,
          dtype={0: nodes_dtype},
      )
  
      edgelist = pd.read_csv(
          cites,
          sep="\t",
          header=None,
          names=["target", "source"],
          dtype=nodes_dtype,
      )
  
      valid_source = node_data.index.get_indexer(edgelist.source) >= 0
      valid_target = node_data.index.get_indexer(edgelist.target) >= 0
      edgelist = edgelist[valid_source & valid_target]
  
      subjects = node_data[subject]
  
      cls = StellarDiGraph if directed else StellarGraph
  
      features = node_data[feature_names]
      if subject_as_feature:
          # one-hot encode the subjects
          features = pd.get_dummies(features, columns=[subject])
  
      graph = cls({"paper": features}, {"cites": edgelist})
  
      if edge_weights is not None:
          # A weighted graph means computing a second StellarGraph after using the unweighted one to
          # compute the weights.
          edgelist["weight"] = edge_weights(graph, subjects, edgelist)
          graph = cls(
              {"paper": node_data[feature_names]}, {"cites": edgelist}
          )
  
      if largest_connected_component_only:
          cc_ids = next(graph.connected_components())
          return graph.subgraph(cc_ids), subjects[cc_ids]
  
      return graph, subjects
  
imports: from .dataset_loader import DatasetLoader
  from ..core.graph import StellarGraph, StellarDiGraph
  import itertools
  import logging
  import os
  import pandas
  import numpy
  from sklearn import preprocessing
  from ..core.experimental import experimental
label_desc: Use image node_id 1 for calling a global function with example usage: _load_cora_or_citeseer(dataset, directed, largest_connected_component_only, subject_as_feature, edge_weights, nodes_dtype) and returns: graph,  subjects, graph,  subjects