annotate core/magnatagatune/ClipComparedGraph.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 % ---
wolffd@0 2 % class ClipComparedGraph
wolffd@0 3 % Directed graph representing comparative clip similarities.
wolffd@0 4 %
wolffd@0 5 % each node represents a clip
wolffd@0 6 % an edge a -> b is present if clipas a and b cooccur
wolffd@0 7 % in a comparison triplet
wolffd@0 8 %
wolffd@0 9 % ---
wolffd@0 10
wolffd@0 11 classdef ClipComparedGraph < Graph
wolffd@0 12
wolffd@0 13 % ---
wolffd@0 14 % the methods
wolffd@0 15 % ---
wolffd@0 16 methods
wolffd@0 17
wolffd@0 18
wolffd@0 19 % constructor of the graph
wolffd@0 20 function G = ClipComparedGraph(comparison, comparison_ids)
wolffd@0 21
wolffd@0 22 if nargin == 2
wolffd@0 23 % ---
wolffd@0 24 % handle automatic or manual input
wolffd@0 25 % ---
wolffd@0 26 for i = 1:size(comparison,1)
wolffd@0 27
wolffd@0 28 % get clips and votes
wolffd@0 29 clips = comparison_ids(comparison(i,1:3));
wolffd@0 30
wolffd@0 31 % edges
wolffd@0 32 G.add_edge(clips(1), clips(2), 1);
wolffd@0 33 G.add_edge(clips(1), clips(3), 1);
wolffd@0 34 G.add_edge(clips(2), clips(3), 1);
wolffd@0 35 %
wolffd@0 36 % % symmectric edges
wolffd@0 37 % G.add_edge(clips(2), clips(1), 1);
wolffd@0 38 % G.add_edge(clips(3), clips(1), 1);
wolffd@0 39 % G.add_edge(clips(3), clips(2), 1);
wolffd@0 40 end
wolffd@0 41
wolffd@0 42 elseif nargin == 1
wolffd@0 43
wolffd@0 44 % ---
wolffd@0 45 % Add the input graph to the empty one
wolffd@0 46 % ---
wolffd@0 47 G.add_graph(comparison);
wolffd@0 48
wolffd@0 49 end
wolffd@0 50
wolffd@0 51 % end constructor function
wolffd@0 52 end
wolffd@0 53
wolffd@0 54 end
wolffd@0 55 end
wolffd@0 56
wolffd@0 57