88 | | ==== behavior sketch ==== |
| 88 | ==== behavior sketch and implementation notes==== |
| 89 | |
| 90 | Validate inputs |
| 91 | start <= end |
| 92 | base.net is NULL or a network |
| 93 | if not NULL coerce toggles, spells, changes to matrix, test for minimum number of columns |
| 94 | network.list is NULL or all elements of list are networks. |
| 95 | if network sizes of network.list items vary, vertex.pid must be non-NULL |
| 96 | if vertex.pid != NULL, it must be present in network vertex attributes |
| 97 | onsets and termini must be NULL or numeric, the same length and the same length as network.list |
| 98 | construct.mode is valid |
| 99 | only one of vertex.toggles, vertex.spells and vertex.changes can be non-NULL |
| 100 | only one of edge.toggles, edge.spells and edge.changes can be non-NULL |
| 101 | if network.list is non-NULL vertex.* and edge.* must be NULL and the reverse |
| 102 | |
101 | | |
102 | | Determine vertex data schema. If more than one of toggles, spells and changes specified, give error. |
103 | | |
104 | | Determine edge data schema. If more than one of toggles, spells and changes specified, give error. |
105 | | |
106 | | set start and end censoring on observation attribute. |
107 | | |
108 | | If nothing specified, return error, otherwise return constructed network dynamic. |
| 115 | |
| 116 | |
| 117 | If base.net exists determine if the set of vertex.ids is consistent with base net |
| 118 | Create new network with properties given by base net if present |
| 119 | |
| 120 | |
| 121 | Determine vertex data schema. |
| 122 | If toggles |
| 123 | activate all vertices present in base net, assuming onset time of -Inf |
| 124 | loop through toggles, activating and deactivating vertices at appropriate times. vertices where last toggle is to active given Inf as terminus. |
| 125 | If changes |
| 126 | activate all vertices present in base net, assuming onset time of -Inf |
| 127 | can convert directly to activation, deactivation lists and apply to vertices in a single pass. vertices where last change is to active given Inf as terminus |
| 128 | If spells |
| 129 | apply activation spells to vertices |
| 130 | |
| 131 | Determine edge data schema. |
| 132 | |
| 133 | If base.net exists, determine if the set of vertex.ids present in the edges data is consistent with it and take action appropriate to construct.mode |
| 134 | |
| 135 | If toggles |
| 136 | Add all edges present in base.net |
| 137 | Set initial edge state according to base net, assuming -Inf as onset. |
| 138 | Add all additional edges implied by toggles |
| 139 | loop through toggles, activating and deactivating edges at appropriate times. All edges where last state is active given Inf as terminus. (Look at pavel's code to see how he did it.) |
| 140 | |
| 141 | If changes |
| 142 | Add all edges present in base.net |
| 143 | Set initial edge state according to base net, assuming -Inf as onset. |
| 144 | Add all additional edges implied by toggles |
| 145 | loop through changes, activating and deactivating edges at appropriate times. All edges where last state is active given Inf as terminus |
| 146 | If spells |
| 147 | |
| 148 | |
| 149 | set start and end censoring on nD observation attribute. |
| 150 | |
| 151 | return constructed networkDynamic. |
116 | | edge activity not consistent with vertex activity |
117 | | network list: base net size different than list net sizes |
118 | | base net has multiplex edges? |
| 159 | |
| 160 | toggles, changes arguments present, but have zero rows: base.net state applied to entire network, respecting start and end if present. if no base.net, no spells added activity status will be determined by active.default argument during query |
| 161 | |
| 162 | spells arguments present, but have zero rows: no spells added, activity status will be determined by active.default argument during query |
| 163 | |
| 164 | network list: base.net size different than list net sizes |
| 165 | |
| 166 | base net has multiplex edges? Not sure how to interpret for toggles, changes and spells. Activate all matching edges? |
| 167 | |
| 168 | network.list has networks with multiplex edges or edges with multiple vertex head- tail-sets. (I think this will work if we write code correctly) |
| 169 | |
| 170 | if all arguments empty, should return empty network, but still no way to specify that. |
| 171 | |
| 172 | edge activity not consistent with vertex activity (edge active when incident vertex is not) : behavior determined by construct.mode |
123 | | What if base.net is a nD object, should we try to append to it? |
| 183 | |
| 184 | What if base.net is a nD object, should we try to append to it? If so, need a way to determine the last state of network for toggles and edges. |
| 185 | |
| 186 | What if vertices/edges need to be inactive at the start of observation in toggles case? Include First toggle at 0 |
| 187 | |
| 188 | If vertex activity is specified, should vertices implied by network size that are never activated be removed? |
| 189 | |
| 190 | |
| 191 | ==== Proposed vertex.pid behavior ==== |
| 192 | how to handle alpha ids and convert them in a stable way to vertex.ids . See pid spec. |
| 193 | |