  A filoop is a generic immersion of a circle in a closed oriented surface,
whose complement is a disjoint union of discs, considered up to orientation
preserving diffeomorphisms. It gives rise to a chord diagram C which has an
interlace graph G, called a chordiagraph. For a graph G with even degrees, we
compute a quantity mg(G) which yields, for every chord diagram $C$ with
interlace graph G, the minimal genus of filoops with chord diagram C. If
mg(G)=0 then C admits exactly two framings of genus 0, corresponding to
spheriloops. After recalling the Cunningham factorisation of connected graphs,
we describe a canonical factorisation of filoops into spheric sums followed by
toric sums, for which the genus is additive. This is analogous to the
factorisation of compact connected 3-manifolds along spheres and tori. We
describe unambiguous context-sensitive grammars generating the set of all
graphs and with mg(G)=0 and deduce stability properties with respect to spheric
and toric factorisations. Similar results hold for chordiagraphs with mg(G) = 0
and their corresponding spheriloops.
