class_docstr: This is the basic field structure,
       which contains the weighted graph structure
       plus an array of data (the 'field')
  field is an array of size(n, p)
        where n is the number of vertices of the graph
        and p is the field dimension
class_docstr_tok: ["This","is","the","basic","field","structure",",","which","contains","the","weighted","graph","structure","plus","an","array","of","data","(","the","'field","'",")","field","is","an","array","of","size","(","n",",","p",")","where","n","is","the","number","of","vertices","of","the","graph","and","p","is","the","field","dimension"]
docstr: Parameters
  ----------
  V (int > 0) the number of vertices of the graph
  edges=None: the edge array of the graph
  weights=None: the associated weights array
  field=None: the field data itself
docstr_tok: ["Parameters","--","--","--","--","--","V","(","int",">","0",")","the","number","of","vertices","of","the","graph","edges=None",":","the","edge","array","of","the","graph","weights=None",":","the","associated","weights","array","field=None",":","the","field","data","itself"]
code: def __init__(self, V, edges=None, weights=None, field=None):
      """
      Parameters
      ----------
      V (int > 0) the number of vertices of the graph
      edges=None: the edge array of the graph
      weights=None: the associated weights array
      field=None: the field data itself
      """
      V = int(V)
      if V < 1:
          raise ValueError("cannot create graph with no vertex")
      self.V = int(V)
      self.E = 0
      self.edges = []
      self.weights = []
      if (edges is not None) or (weights is not None):
          if len(edges) == 0:
              E = 0
          elif edges.shape[0] == np.size(weights):
              E = edges.shape[0]
          else:
              raise ValueError(
                  "Incompatible size of the edges \
                                    and weights matrices"
              )
          self.V = V
          self.E = E
          self.edges = edges
          self.weights = weights
      self.field = []
      if field is None:
          pass
      else:
          if np.size(field) == self.V:
              field = np.reshape(field, (self.V, 1))
          if field.shape[0] != self.V:
              raise ValueError("field does not have a correct size")
          else:
              self.field = field
  
imports: from warnings import warn
  import numpy
  from .graph import Graph, WeightedGraph
label_desc: Use image node_id 1 to create a new Field object from inherited base classes: WeightedGraph with example: obj = Field(V, edges, weights, field)