code: def is_full_dag(matrix):
      """Full DAG == all vertices on a path from vert 0 to (V-1).
  
      i.e. no disconnected or "hanging" vertices.
  
      It is sufficient to check for:
        1) no rows of 0 except for row V-1 (only output vertex has no out-edges)
        2) no cols of 0 except for col 0 (only input vertex has no in-edges)
  
      Args:
        matrix: V x V upper-triangular adjacency matrix
  
      Returns:
        True if the there are no dangling vertices.
      """
      shape = np.shape(matrix)
  
      rows = matrix[: shape[0] - 1, :] == 0
      rows = np.all(rows, axis=1)  # Any row with all 0 will be True
      rows_bad = np.any(rows)
  
      cols = matrix[:, 1:] == 0
      cols = np.all(cols, axis=0)  # Any col with all 0 will be True
      cols_bad = np.any(cols)
  
      return (not rows_bad) and (not cols_bad)
  
file_path: singa/examples/model_selection/TRAILS-Database-Native-Model-Selection/internal/ml/model_selection/src/third_pkg/sp101_lib/graph_util.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import hashlib
  import itertools
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: is_full_dag(matrix) and returns: unknown